Date Format codes in java SimpleDateFormat class

Symbol Meaning Presentation Example
y/yyy/yyyy year in four digit format (Number) 2011
yy year in two digit format(returns last two digits) (Text) 11 for year 2011
M month number in without trailing zeroes (Number) 7 for July
MM month number in with trailing zeroes (Text) 07 for July
MMM short name of the month (Text) Jul for July
MMMM full name of the month (Text) July
E/EE/EEE short name of day of week (Text) Tue
EEEE full name of day of week (Text) Tuesday
d month number in without trailing zeroes (Number) 2
dd month number in with trailing zeroes (Text) 02
h hour in am/pm (1-12) without trailing zeroes (Number) 12
hh hour in am/pm (1-12)with trailing zeroes (Number) 09
H hour in day (0-23) without trailing zeroes (Number) 16
HH hour in day (0-23) with trailing zeroes (Number) 08
m minute in hour without trailing zeroes (Number) 8
mm minute in hour with trailing zeroes (Number) 08
s second in minute without trailing zeroes (Number) 5
ss second in minute with trailing zeroes (Number) 05
D day in year (Number) 189
F day of week in month (Number) 2 (2nd Wed in July)
G era designator (Text) AD
K hour in am/pm (0-11) (Number) 0
L stand-alone month (Text/Number) July / 07
M month in year (Text/Number) July / 07
S fractional seconds (Number) 978
W week in month (Number) 2
Z time zone (RFC 822) (Timezone) -0800
a am/pm marker (Text) PM
c stand-alone day of week (Text/Number) Tuesday / 2
k hour in day (1-24) (Number) 24
w week in year (Number) 27
z time zone (Timezone) Pacific Standard Time
escape for text (Delimiter) ‘Date=’
single quote (Literal) ‘o”clock’
Advertisements

Tags: , , , , , , ,

About krishjlk

http://www.facebook.com/krishna.kanth.121

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: