Date patterns

The following symbols are used to create date patterns:

Table 1. format date pattern
Symbol Description Example
G The era, expressed as AD or BC. AD
y The year. 1997
Y The year. 1997
u The extended year. 4601
M The month. 11
d The day of the month. 23
h The hour for a twelve-hour clock (1-12). 11
H The hour for a twenty-four hour clock (0-23). 23
m The minute of the hour (1-59) 34
s The second of the minute (1-59). 12
S The fractional second, expressed as a decimal value. 234
E The day of the week, as text. Tuesday
e The day of the week, as a number (1-7). 2
D The day of the year (1-366). 234
F The occurrence of that weekday in the month (1-5). For example, the second Wednesday in the month. 2
w The week in the year (1-52). 27
W The week in the month (1-5). 3
a The meridiem, expressed as AM or PM. AM
k The hour in the day (1-24). 23
K The hour in the day (0-11) 3
g The Julian day. 2451334
A The millisecond in the day. 69540000
' Use to enclose text you want to display. 'Date='
'' Use to write a single quote as part of text. 'o'clock'

When creating date patterns, you can repeat the placeholder to determine which format to use. For example, a single e represents the day of the week as a single digit, such as 3. Two e's (ee) represents the day of the week as two digits, such as 03. Three E's (EEE) represents the day of the week as short text, such as Wed. And finally, four E's (EEEE) represents the day of the week as full text, such as Wednesday.