EXSLT - date:format-date - Implementer Page

Version: 2
Status: implemented
User Page: index.html
XML Definition: date.format-date.xml
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:

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.

An implementation of this extension function in the EXSLT date namespace must conform to the behaviour described in this document.

Implementations

No XSLT processors that we know of have built-in support for date:format-date.

The following implementations of date:format-date are available:

LanguageImplemented VersionCreatorDateDownload
Javascript2Chris Bayes2001-06-11date.js
Msxsl2Chris Bayes2001-06-16date.msxsl.xsl
EXSLT Function2Jeni Tennison2001-06-07date.format-date.function.xsl
XSLT Template2Jeni Tennison2001-06-07date.format-date.template.xsl

Change History

Previous Version: date.format-date.1.html

VersionModifiedByDetails
22001-06-07Jeni Tennison

Removed third (optional date format) argument.

2.12001-06-11Jeni Tennison

Added Javascript implementation.

2.22001-06-16Jeni Tennison
  • Updated Javascript implementation.
  • Added Microsoft-specific stylesheet.
2.32001-08-10Jeni Tennison

Added XSLT template and EXSLT - Functions implementation.

http://www.exslt.org/date/functions/format-date/date.format-date.html last modified 2001-08-10