Previous


SimpleDateFormat Pattern Fields

The formatter supports many different fields you can use to create patterns. ASCII letters are reserved as pattern letters (unless enclosed in quotes), defined as the following:

Symbol

Meaning

Presentation

Example

G

era designator

(Text)

AD

y

year

(Number)

1996

M

month in year

(Text / Number)

July / 07

d

day in month

(Number)

10

k

hour in day

(Number)

24

H

hour in day, 0-based

(Number)

0

m

minute in hour

(Number)

30

s

second in minute

(Number)

55

S

millisecond

(Number)

978

E

day in week

(Text)

Tuesday

D

day in year

(Number)

189

F

day of week in month

(Number)

2 (2nd Wed in July)

w

week in year

(Number)

27

W

week in month

(Number)

2

a

am/pm marker

(Text)

PM

h

hour in am/pm

(Number)

12

K

hour in am/pm, 0-based

(Number)

0

z

time zone

(Text)

PST

'

escape for text

 

 

''

single quote

 

'


This page incorporates material or code copyrighted by Taligent, Inc. For more information on international resources, see their International Fact Sheet.


Previous