# xslt:format-time

Function signature

$value | xs:time ?
$picture | xs:string
$language | xs:string ?
$calendar | xs:string ?
$country | xs:string ?
Result | xs:string

XSLT 2.0 Specification

Formats a date, using a format controlled by the picture string. If no language is specified, the value is taken from the current Java locale. If the language (explicitly supplied or defaulted) is other than "en", the system tries to locate a class named `net.sf.saxon.number.Numberer_XX` where XX is the language; this class must provide methods to perform the localization.

If a calendar other than AD or ISO is specified, the result is prefixed "[Calendar: AD]" and is otherwise output as if the default calendar were used.

The country argument is currently used only when the format requests output of timezones by name (using `[ZN]`): for example with language="en", country="gb" and a date that falls in British Summer Time, +01:00 is output as "BST". This is problematic, because the information is not really available: the data type maintains only a time zone offset, and different countries (time zones) use different names for the same offset, at different times of year. If the value is a date or dateTime, and if the country argument is supplied, Saxon uses the Java database of time zones and daylight savings time (summer time) changeover dates to work out the most likely timezone applicable to the date in question.

If the timezone is formatted as [ZN,6] (specifically, with a minumum length of 6 or more) then the Olsen timezone name is output (again, this requires the country to be supplied). The Olsen timezone name generally takes the form `Continent/City`, for example "Europe/London" or "America/Los_Angeles". If the date/time is in daylight savings time for that timezone, an asterisk is appended to the Olsen timezone name.

When formatting times in the 12-hour clock, with language="en", the abbreviations "a.m." and "p.m." are used. These can be shortened to "am" and "pm" by giving a maximum width of 2 (`[PN,*-2]`). The US convention of denoting noon as "pm" and midnight as "am" is followed, unless the maximum width is 8 or more (`[PN,*-8]`) in which case these values are represented as "noon" and "midnight" respectively.

Function signature

$value | xs:time ?
$picture | xs:string
Result | xs:string

Formats a time, using a format controlled by the picture string. This has the same effect as calling the 5-argument form of the function with an empty sequence supplied for the last three arguments.

XSLT 2.0 Specification

Next