Name
[2.0] format-date()
Formats an xs:date
value according to a format
string.
Syntax
xs:string?format-date(
xs:date?
,xs:string
)
xs:string?format-date(
xs:date?
,xs:string
,$language as xs:string?
,$calendar as xs:string?
,$country as xs:string?
)
Inputs
In the first form of this function, an optional xs:date
value and a formatting string.
If the xs:date
value is
omitted, the current date is used. In the second form of this
function, you can supply strings that represent the preferred
language, calendar, and country codes for the output value.
The following codes are defined for the formatting string.
The default values are how the processor interprets codes without
any modifiers. In other words, [Y]
is the same as [Y1]
. The codes are:
Y
The year. The default value is
[Y1]
, which generates a four-digit year.M
The month in the year. The default value is
[M1]
, which generates a one- or two-digit numeric month.D
The day in the month. The default value is
[D1]
, which generates a one- or two-digit numeric day.d
The day in the year. The default value is
[d1]
, which generates a one-, two-, or three-digit day (if the date is July 26 of a nonleap year, this generates207
, for example).F
The day in the week. The default value is
[Fn]
, which generates the lowercase word representing the day of the week (wednesday
, for example).W
The week in the year. The default value is
[W1]
, which generates the one- or two-digit number of the week in the year.w
The week in the month. The default value is
[w1]
, which ...
Get XSLT, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.