Formatting dates

Formatting of dates is achieved using the functions fn:format-date(), fn:format-time(), and fn:format-dateTime(). The third argument of these functions supplies the requested language; the fifth argument supplies the requested "place". If not supplied, the defaults are taken from the Saxon configuration (properties DEFAULT_LANGUAGE and DEFAULT_COUNTRY; if these are not set, they fall back to values obtained from operating system settings.

Where parts of a date are formatted as numbers (for example "1st December") the rules closely follow the rules for formatting of numbers. This includes spellout numbering (for example "December First, Two Thousand and Twenty-One").

Month names and day names (e.g. "January", "Friday") are handled as follows:

Formatting of timezones is complex. Named timezones (such as EST, PDT) are used only if the place argument represents the US or UK, and only if the timezone is one of a number of abbreviations that are commonly recognized in those countries. The rules take into account whether the date is in daylight savings (summer) time.

For more details on writing a plug-in for localizing numbers and dates, see Localizing numbers and dates.