Format Date

This data converter reformats a date. The input text must be a date in the standard date format, e.g. "2001-02-25 14:32:49.0".

Note: If you want to convert a date to the standard date format, use the Extract Date data converter.

Properties

The Format Date data converter is configured using the following properties:

Locale:
This field specifies the locale that the date is to be formatted to.
Format Pattern:
Contains a pattern that specifies the format of the date. Either use one of the default patterns, or see below for details about specifying a pattern.
Description:
Type in a description to be shown in the list of data converters. If there is no type in a description, one will be generated.

Specifying a format pattern

The format pattern provides a very flexible way of specifying the date format. However, the rules for specifying the pattern can be somewhat difficult to understand, so it might be easier to simply find the default pattern that matches the required format best, and then experiment with changing that default pattern.

In a pattern, the following special characters can be used:

Special Character Meaning Type Example
y,yy,yyy year Number 96
yyyy year Number 1996
M month Number 7
MM month Number 07
MMM month Text Jul
MMMM month Text July
d,dd day in month Number 10
(d)ddd day in month Number (0)010
E,EE,EEE day in week Text Tue
EEEE day in week Text Tuesday
D,DD,(D)DDD day in year Number (0)189
(F)F day of week in month Number (0)2 (2nd Wed in July)
w,(w)ww week in year Number (0)27
(W)W week in month Number (0)2
(H)H hour in day (0-23) Number (0)4 or (0)12
(k)k hour in day (1-24) Number (0)4 or (0)12
(K)K hour in am/pm (0-11) Number (0)0
(h)h hour in am/pm (1-12) Number (0)5 or (0)12
(m)m minute in hour Number (0)30
(s)s second in minute Number (0)55
S,SS,(S)SSS millisecond Number (0)978
a am/pm marker Text PM
z,zz,zzz time zone Text PST
(z)zzzz time zone Text Pacific Standard Time
G era designator Text AD
' start/end of text not in input Delimiter 'o''clock' -> o'clock
'' single quote Literal "EEEE" -> "Friday"

Any characters in the pattern that are not letters in the range A-Z or a-z will be treated as text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting date even though they are not enclosed in single quotes.

If the pattern is empty, the default date format for the selected locale is used.

Examples

Examples of output dates if the locale is "English (United States)":

Format Pattern Example of output date
yyyy.MM.dd G 'at' hh:mm:ss z 1996.07.10 AD at 15:08:56 PDT
EEE, MMM d, ''yy Wed, July 10, '96
h:mm a 12:08 PM
hh 'o''clock' a, zzzz 12 o'clock PM, Pacific Daylight Time
K:mm a, z 0:00 PM, PST
yyyyy.MMMMM.dd GGG hh:mm aaa 1996.July.10 AD 12:08 PM