The Format Date String function converts the XML Schema data type: xs:dateTime to a string in the format defined by the second parameter.
Parameter: dateTime
The date and time as a XML Schema data type: xs:dateTime.
Parameter: string
Pattern Letter | Description | Example1 | Example2 |
---|---|---|---|
G | Era designation | AD | BC |
y | Year | 2004 | 2001 |
M | Month in a year | April | 04 |
w | Week in a year | 12 | 24 |
W | Week in a month | 3 | 1 |
D | Day in a year | 234 | 333 |
d | Day in a month | 13 | 20 |
F | Day of week in a month | 1 | 3 |
E | Day in a week | Monday | Friday |
a | AM or PM designation | AM | PM |
H | Hour in a day - a number between 0 and 23 | 12 | 13 |
k | Hour in a day - a number between 1 and 24 | 14 | 23 |
K | Hour in AM or PM - a number between 0 and 11 | 0 | 10 |
h | Hour in AM or PM - a number between 1 and 12 | 11 | 12 |
m | Minute in an hour | 20 | 50 |
s | Second in a minute | 10 | 30 |
S | Milliseconds | 224 | 338 |
z | Time zone in General time zone designation | PDT | EDT |
Z | Time zone in RFC 822 time zone designation | -0300 | +0200 |
This string defines the locale. For example, the English United States locale is defined with the following string: en_US.
The locale string can be defined by any of the following formats:
This parameter is optional.
Returns: string
The passed in date and time as a string in the format defined by the second parameter.
For example, if the Format Date String function was called with the following input parameters:
dateTime: 2005-02-22T16:18:00.852-08:00
format string: MM/dd/yyyy
locale string: en_US
The following string would be returned: 02/22/2005.