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 |
XSLT Function DeclarationSee XQuery definition. | <xsl:function name="functx:date" as="xs:date"
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:sequence select="
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)))
"/>
</xsl:function>
|
ExamplesXPath 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:
|