home contribute faq download

FunctX XSLT Functions

functx:dateTime

Construct a date/time from individual components

Google
Webxsltfunctions.com

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 Type

NameTypeDescription
$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 Declaration

See 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>

Examples

XPath ExampleResults
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 On

functx:dateConstruct a date from a year, month and day
functx:timeConstruct a time from an hour, minute and second

See Also

functx:dateConstruct a date from a year, month and day
functx:timeConstruct a time from an hour, minute and second

History

Published OnLast UpdatedContributor(s)
2006-08-222007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Datypic XSLT Services

Recommended Reading:

XQuery