Pattern | Example | Description |
Era | ||
G..GGG |
AD | Era (short) |
GGGG |
Anno Domini | Era (long) |
GGGGG |
A | Era (narrow) |
Year | ||
y |
2, 20, 201, 2017 |
Calendar year Zero padded to pattern length. The yy format will always use the 2 low-order digits of the year.
|
yy |
02, 20, 01, 17 | |
yyy |
002, 020, 201, 2017 | |
yyyy+ |
0002, 0020, 0201, 2017 | |
Y |
2, 20, 201, 2017 |
Week year Zero padded to pattern length. The YY format will always use the 2 low-order digits of the year.
|
YY |
02, 20, 01, 17 | |
YYY |
002, 020, 201, 2017 | |
YYYY+ |
0002, 0020, 0201, 2017 | |
Quarter | ||
q |
2 | Quarter |
qq |
02 | Quarter (2-digits) |
Q |
2 | Standalone Quarter |
QQ |
02 | Standalone Quarter (2-digits) |
Month | ||
M |
9, 12 | Month number |
MM |
09, 12 | Month number (2-digits) |
MMM |
Sep | Month name (short) |
MMMM |
September | Month name (long) |
MMMMM |
S | Month name (narrow) |
L |
9, 12 | Standalone Month number |
LL |
09, 12 | Standalone Month number (2-digits) |
LLL |
Sep | Standalone Month name (short) |
LLLL |
September | Standalone Month name (long) |
LLLLL |
S | Standalone Month name (narrow) |
Week | ||
w |
8, 27 | Week of year |
ww |
08, 27 | Week of year (2-digits) |
W |
3 | Week of month. |
Day | ||
d |
1 | Day of month |
dd |
01 | Day of month (2-digits) |
D..DDD |
345 |
Day of year Zero padded to pattern length. |
F |
2 | Day of week in month |
Week Day | ||
E..EEE |
Tue | Day of week name (short) |
EEEE |
Tuesday | Day of week name (long) |
EEEEE |
T | Day of week name (narrow) |
e |
2 | Day of week number |
ee |
02 | Day of week number (2-digits) |
eee |
Tue | Day of week name (short) |
eeee |
Tuesday | Day of week name (long) |
eeeee |
T | Day of week name (narrow) |
c |
2 | Standalone Day of week number |
cc |
02 | Standalone Day of week number (2-digits) |
ccc |
Tue | Standalone Day of week name (short) |
cccc |
Tuesday | Standalone Day of week name (long) |
ccccc |
T | Standalone Day of week name (narrow) |
Day Period | ||
a..aaa |
am | Day period (short) |
aaaa |
am | Day period (long) |
Hour | ||
h |
1, 12 | Hour [1-12] |
hh |
01, 12 | Hour [1-12] (2-digits) |
H |
0, 23 | Hour [0-23] |
HH |
00, 23 | Hour [0-23] (2-digits) |
K |
0, 11 | Hour [0-11] |
KK |
00, 11 | Hour [0-11] (2-digits) |
k |
1, 24 | Hour [1-24] |
kk |
01, 24 | Hour [1-24] (2-digits) |
Minute | ||
m |
8, 59 | Minute |
mm |
08, 59 | Minute (2-digits) |
Second | ||
s |
8, 12 | Second |
ss |
08, 12 | Second (2-digits) |
S+ |
3456 |
Fractional second Truncated to pattern length. |
Time Zone | ||
z..zzz |
PDT | Short specific non-location format* |
zzzz |
Pacific Daylight Time | Long specific non-location format* |
Z..ZZZ |
-0800 | ISO8601 basic format |
ZZZZ |
GMT-8:00 | Long localized GMT format |
ZZZZZ |
-8:00 | ISO8601 extended format |
O |
GMT-8 | Short localized GMT format |
OOOO |
GMT-8:00 | Long localized GMT format |
VV |
America/Los_Angeles | Long time zone ID |
X |
-08, +0530, Z | ISO8601 basic format with Z (optional minutes) |
XX |
-0800, Z | ISO8601 basic format with Z |
XXX |
-08:00, Z | ISO8601 extended format with Z |
x |
-08, +0530, +00 | ISO8601 basic format (optional minutes) |
xx |
-0800, +0000 | ISO8601 basic format |
xxx |
-08:00, +00:00 | ISO8601 extended format |
* Output only
Characters wrapped in '
quotes will not be parsed.