1. Главная
  2. Функции XPath
  3. date:date()

date:date XPath

The date:date function returns the date specified in the date/time string given as the argument. If no argument is given, then the current local date/time, as returned by date:date-time is used as a default argument.

Синтаксис

EXSLT Function Syntax

string date:date(string?)

EXSLT Template Syntax

<xsl:call-template name="date:date">
    <xsl:with-param name="date-time" select="string" />?
</xsl:call-template>

Описание и примеры

The date/time string specified as an argument must be a string in the format defined as the lexical representation of either xs:dateTime in 3.2.7 dateTime or xs:date in 3.2.9 date of XML Schema Part 2: Datatypes. If the argument is not in either of these formats, date:date returns an empty string ('').

The date/time format is basically CCYY-MM-DDThh:mm:ss, although implementers should consult XML Schema Part 2: Datatypes and ISO 8601 for details.

The date is returned as a string with a lexical representation as defined for xs:date in 3.2.9 date of XML Schema Part 2: Datatypes.

The date format is basically CCYY-MM-DD, although implementers should consult XML Schema Part 2: Datatypes and ISO 8601 for details.

If no argument is given or the argument date/time specifies a time zone, then the date string format must include a time zone, either a Z to indicate Coordinated Universal Time or a + or - followed by the difference between the difference from UTC represented as hh:mm. If an argument is specified and it does not specify a time zone, then the date string format must not include a time zone.

Implementations

The following XSLT processors support date:date:

  • SAXON from Michael Kay (version 6.4.2)
  • Xalan-J from Apache (version 2.4.D1)
  • 4XSLT, from 4Suite. (version 0.12.0a3)
  • libxslt from Daniel Veillard et al. (version 1.0.19)

Implementations of date:date are available in the following languages: