Description
The functx:date function constructs an xs:date value from arguments representing the year, month and day. The arguments can have any type that can be cast to xs:integer . If the combination does not result in a valid date (e.g. the day is 32 or the month is 13), an error is raised.
Arguments and Return TypeName | Type | Description |
$year |
xs:anyAtomicType |
the year |
$month |
xs:anyAtomicType |
the month |
$day |
xs:anyAtomicType |
the day |
return value |
xs:date |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:date
( $year as xs:anyAtomicType ,
$month as xs:anyAtomicType ,
$day as xs:anyAtomicType ) as xs:date {
xs:date(
concat(
functx:pad-integer-to-length(xs:integer($year),4),'-',
functx:pad-integer-to-length(xs:integer($month),2),'-',
functx:pad-integer-to-length(xs:integer($day),2)))
} ; |
ExamplesXQuery Example | Results |
---|
functx:date(2006,6,12) |
2006-06-12 |
functx:date('2006','06','12') |
2006-06-12 |
Depends OnSee Alsofunctx:time | Construct a time from an hour, minute and second |
History |
Recommended Reading:
|