Description
The functx:time function constructs an xs:time value from arguments representing the 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 hour is 25 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 |
$hour |
xs:anyAtomicType |
the hour |
$minute |
xs:anyAtomicType |
the minute |
$second |
xs:anyAtomicType |
the second |
return value |
xs:time |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:time
( $hour as xs:anyAtomicType ,
$minute as xs:anyAtomicType ,
$second as xs:anyAtomicType ) as xs:time {
xs:time(
concat(
functx:pad-integer-to-length(xs:integer($hour),2),':',
functx:pad-integer-to-length(xs:integer($minute),2),':',
functx:pad-integer-to-length(xs:integer($second),2)))
} ; |
ExamplesXQuery Example | Results |
---|
functx:time(20,6,12) |
20:06:12 |
functx:time('20','6','12') |
20:06:12 |
Depends OnSee AlsoHistory |
Recommended Reading:
|