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:
YThe year. The default value is
[Y1], which generates a four-digit year.MThe month in the year. The default value is
[M1], which generates a one- or two-digit numeric month.DThe day in the month. The default value is
[D1], which generates a one- or two-digit numeric day.dThe 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).FThe day in the week. The default value is
[Fn], which generates the lowercase word representing the day of the week (wednesday, for example).WThe week in the year. The default value is
[W1], which generates the one- or two-digit number of the week in the year.wThe week in the month. The default value is
[w1], which ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access