Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
See Also
ceiling()
on page 723
round()
on page 870
Converting to an xs:integer
in Chapter 9, page 667
The
idiv
operator, under
Arithmetic Operators
in Chapter 8, page 574
format-date, format-dateTime, format-time
These three functions are available in XSLT only
.
The three functions
format-date()
,
format-dateTime()
, and
format-time()
return a formatted representation of a date and/or time, as a string. For example,
format-date(current-date(), ‘[MNn] [D], [Y]’)
might return the string
December 31, 2009
.
Signature
Argument | Type | Meaning |
value | xs:date? xs:dateTime? xs:time? | The date, dateTime, or time to be formatted. The type of value is determined by the name of the function. |
picture | xs:string | A picture string identifying the components to be output and the format in which they are output. |
language (optional) | xs:string? | A string following the same rules as the xml:lang attribute in XML, to indicate the language to be used for formatting the date/time. For example, en indicates English, de German, and es Spanish. |
calendar (optional) | xs:string? | A string giving a code for the calendar to be used for formatting the date/time. |
country (optional) | xs:string? | A code identifying the country associated with the date/time, for example the country in which the dated event took place. |
Result | xs:string? | The formatted date/time . |
The last three arguments are optional, but they must either all be supplied or all be omitted. That is, the function must be called either with two arguments or with five. Calling it with two arguments is equivalent to supplying an empty sequence
()
for each of the last three arguments; an empty sequence for any of these arguments invokes the default value.