Format Date String function

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

This string defines the format of the date and time string returned from this function. For example, the format string could be equal to MM/dd/yyyy. For more information about the supported date and time pattern strings see the SimpleDataFormat class in the Sun J2SE 1.4.2 JavaDoc: http://www.science.uva.nl/ict/ossdocs/java/jdk1.3/docs/api/java/text/SimpleDateFormat.html.
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
Parameter: string  (Optional)

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:

  • LANGUAGE
  • LANGUAGE_COUNTRY
  • LANGUAGE_COUNTRY_VARIANT
Where LANGUAGE represents a two letter code as defined by the ISO-639 standard, COUNTRY represents a two letter code defined by the ISO-3166, and VARIANT represents a vendor or browser-specific code, for example WIN for Windows.

This parameter is optional.

To add this parameter:
  1. Drop the Format Date String function into the middle pane of the Mapping Editor.
  2. Double-click the function. The Function Properties pane opens.
  3. Click Add. The Locale input parameter shows in the list of parameters.

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.