Citation :
Implementer Page: date.format-date.html
Function Package: date.format-date.zip
Function Syntax
string date:format-date(string, string)
Template Syntax
<xsl:call-template name="date:format-date">
<xsl:with-param name="date-time" select="string" />
<xsl:with-param name="pattern" select="string" />
</xsl:call-template>
The date:format-date function formats a date/time according to a pattern. The first argument to date:format-date specifies the date/time to be formatted. It must be right or left-truncated date/time strings in one of the formats defined in [XML Schema Part 2: Datatypes]. The permitted formats are as follows: xs:dateTime (CCYY-MM-DDThh:mm:ss) xs:date (CCYY-MM-DD) xs:time (hh:mm:ss) xs:gYearMonth (CCYY-MM) xs:gYear (CCYY) xs:gMonthDay (--MM-DD) xs:gMonth (--MM--) xs:gDay (---DD) The second argument is a string that gives the format pattern used to format the date. The format pattern must be in the syntax specified by the JDK 1.1 SimpleDateFormat class. The format pattern string is interpreted as described for the JDK 1.1 SimpleDateFormat class. If the date/time format is right-truncated (i.e. in a format other than xs:time, or xs:dateTime) then any missing components are assumed to be as follows: if no month is specified, it is given a month of 01; if no day is specified, it is given a day of 01; if no time is specified, it is given a time of 00:00:00. If the date/time format is left-truncated (i.e. xs:time, xs:gMonthDay, xs:gMonth or xs:gDay) and the format pattern has a token that uses a component that is missing from the date/time format used, then that token is replaced with an empty string ('' within the result. ImplementationsThere are currently no XSLT processors that we know of that support date:format-date natively.
Implementations of date:format-date are available in the following languages: Javascript (by Chris Bayes)
Msxsl (by Chris Bayes)
EXSLT Function (by Jeni Tennison)
XSLT Template (by Jeni Tennison)
|