Appendix E. Date and Time format

Mapping framework uses java.text.SimpleDateFormatclass to work with dates.

Date and time formats are specified by date and time pattern strings. Within date and time pattern strings, unquoted letters from 'A' to 'Z' and from 'a' to 'z' are interpreted as pattern letters representing the components of a date or time string. Text can be quoted using single quotes (') to avoid interpretation. ''represents a single quote. All other characters are not interpreted; they're simply copied into the output string during formatting or matched against the input string during parsing.

The following pattern letters are defined (all other characters from 'A' to 'Z' and from 'a' to 'z' are reserved):

Letter

DateorTimeComponent

Presentation

Examples

G

Eradesignator

Text

AD

y

Year

Year

1996; 96

M

Monthinyear

Month

July; Jul; 07

w

Weekinyear

Number

27

W

Weekinmonth

Number

2

D

Dayinyear

Number

189

d

Dayinmonth

Number

10

F

Day of week in month

Number

2

E

Dayinweek

Text

Tuesday; Tue

a

Am/pmmarker

Text

PM

H

Hourinday (0-23)

Number

0

k

Hourinday (1-24)

Number

24

K

Hourinam/pm (0-11)

Number

0

h

Hourinam/pm (1-12)

Number

12

m

Minuteinhour

Number

30

s

Secondinminute

Number

55

S

Millisecond

Number

978

z

Timezone

Generaltimezone

Pacific Standard Time; PST; GMT-08:00

Z

Timezone

RFC 822 timezone

-0800

Table 42.Letter patterns

Pattern letters are usually repeated, as their number determines the exact presentation:

For parsing, if the number of pattern letters is more than 2, the year is interpreted literally, regardless of the number of digits. So using the pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D.

The following examples show how date and time patterns are interpreted in the U.S. locale. The given date and time are 2001-07-04 12:08:56 local time in the U.S. Pacific Time time zone.

DateandTimePattern

Result

"yyyy.MM.dd G 'at' HH:mm:ss z"

2001.07.04 AD at 12:08:56 PDT

"EEE, MMM d, ''yy"

Wed, Jul 4, '01

"h:mm a"

12:08 PM

"hh 'o''clock' a, zzzz"

12 o'clock PM, Pacific Daylight Time

"K:mm a, z"

0:08 PM, PDT

"yyyyy.MMMMM.dd GGG hh:mmaaa"

02001.July.04 AD 12:08 PM

"EEE, dMMMyyyyHH:mm:ssZ"

Wed, 4 Jul 2001 12:08:56 -0700

"yyMMddHHmmssZ"

010704120856-0700

Table 43.Patterns usage examples