Name
[2.0] format-dateTime()
Formats an xs:dateTime value according to a format
string.
Syntax
xs:string?format-dateTime(xs:dateTime?,$picture as xs:string)xs:string?format-dateTime(xs:dateTime?,$picture as 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:dateTime value and a formatting
string. If the xs:dateTime
value is omitted, the current date and time 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:
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 generates the one-digit number of the week in the month.HThe hour in the ...
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