Date-time fields
Letter
Date or time component
Examples
G
Era designator
AD
y
Year
yyyy →2017, yy → 17
M
Month in year
M → 1
If you use the format MM, months 1 to 9 are preceded by a zero:
MM → 01
If you use the format MMM, the month is shown as an abbreviation:
MMM → Jan
If you use the format MMMM, the complete names of the months are shown:
MMMM → January
w
Week in year
W, yyyy → 9, 2017
If you use the format ww, weeks 1 to 9 are preceded by a zero:
ww, yyyy → 09 2017
W
Week in month
MMMM, W → September, 2
If you use the format WW, the week number is preceded by a zero:
MMMM, WW → September, 02
D
Day in year
D, yyyy → 250, 2017
If you use the format DDD, the days 1 to 99 are preceded by a zero:
DDD, yyyy→ 025, 2017
d
Day in month
d MMMM yyyy → 7 Sep 2017
If you use the format dd, days 1 to 9 are preceded by a zero:
dd MMMM yyyy → 07 Sep 2017
F
Day of week in month
F → 2
E
Day in week
E dd MMMM yyyy →
Thu 07 September 2017
If you use the format EEEE, the complete names of the days are shown:
EEEE dd MMMM yyyy →
Thursday 07 September 2017
a
Am/pm marker
h:mm a → 12:08 PM
H
Hour in day
(0-23)
H:mm → 0:00
k
Hour in day
(1-24)
k:mm → 24:00
K
Hour in am/pm (0-11)
K:mm → 0:00
h
Hour in am/pm (1-12)
h:mm → 12:00
m
Minute in hour
H:m → 7:45
If you use the format mm, minutes 1 to 9 are preceded by a zero:
H:mm → 10:05
s
Second in minute
H:mm:s → 10:08:55
If you use the format ss, seconds 1 to 9 are preceded by a zero:
H:mm:ss → 10:08:05
z
Time zone
HH:mm z → 10:08 CEST
If you use the format zzzz, the complete names of the time zones are shown:
HH:mm zzzz → 10:08 Central European Summer Time
Z
Time zone
HH:mm Z → 10:08 +0200