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 |
XSLT Function DeclarationSee XQuery definition. | <xsl:function name="functx:dateTime" as="xs:dateTime"
xmlns:functx="http://www.functx.com">
<xsl:param name="year" as="xs:anyAtomicType"/>
<xsl:param name="month" as="xs:anyAtomicType"/>
<xsl:param name="day" as="xs:anyAtomicType"/>
<xsl:param name="hour" as="xs:anyAtomicType"/>
<xsl:param name="minute" as="xs:anyAtomicType"/>
<xsl:param name="second" as="xs:anyAtomicType"/>
<xsl:sequence select="
xs:dateTime(
concat(functx:date($year,$month,$day),'T',
functx:time($hour,$minute,$second)))
"/>
</xsl:function>
|
ExamplesXPath 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:
|