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:

Y

The year. The default value is [Y1], which generates a four-digit year.

M

The month in the year. The default value is [M1], which generates a one- or two-digit numeric month.

D

The day in the month. The default value is [D1], which generates a one- or two-digit numeric day.

d

The 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 generates 207, for example).

F

The day in the week. The default value is [Fn], which generates the lowercase word representing the day of the week (wednesday, for example).

W

The week in the year. The default value is [W1], which generates the one- or two-digit number of the week in the year.

w

The week in the month. The default value is [w1], which generates the one-digit number of the week in the month.

H

The hour in the ...

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.