Java Reference
In-Depth Information
Table 12-6. Datetime Formatting Symbols, Their Descriptions with Examples
Symbol
Description
Examples
Pattern
Output
G
G
AD
Era
GGGG
Anno Domini
GGGGG
A
u
u/uuu/uuuu
2012
Year
It can be a positive or negative number. After an era start
date, it is a positive number. Before an era start date, it is a
negative number. For example, the year value for 2014 AD
is 2014 and the year value for 2014 BC is -2014.
uu
12
uuuuu
02012
y
y/yyy/yyyy
2012
Year of era
It counts the year forward or backward from the era start
date. It is always a positive number. For example, the year
value for 2014 AD is 2014 and the year value for 2014 BC is
2015. In Common Era, year 0 is 1 BC.
yy
12
yyyyy
02012
D
D
150
Day of year (1 -366)
M/L
Month of year
M
5
MM
05
MMM
Jul
MMMM
July
d
d
29
Day of month
The pattern d will output values like 1, 2, 10, 29, etc. The
pattern dd will zero-pad the values as 01, 02, 10, 29, etc. to
make them always two digits. The pattern ddd will output
values like 001, 010, 029, etc.
Q/q
Quarter of year
Q
3
QQ
03
QQQ
Q3
QQQQ
3rd quarter
Y
Y
2012
Week-based year
YY
12
YYY/YYYY
2012
w
w
31
Week of week-based year
W
W
5
Week of month
E
E
7
Day of week
EE
07
EEE
Sun
EEEEE
Sunday
( continued )
 
Search WWH ::




Custom Search