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