Droid2Formats

These are formatting code for use with format or inside string literal formats.

Date & Time

Code

Example

Description

YY

08

2-digit zero-padded year

YYYY

2008

Full year

M

7

1- or 2-digit month

MM

07

2-digit zero-padded month

D

2

1- or 2-digit day

DD

02

2-digit zero-padded day

W

4

1- or 2-digit week

WW

04

2-digit zero-padded week

S

Jan

Short month name

L

January

Long month name

E

Mon

Short day of the week name

K

Monday

Long day of the week name

O

2nd

Ornate day of month

Q

4

Quarter number

h

9

1- or 2-digit hours (24 hour clock)

hh

09

2-digit zero-padded hours (24 hour clock)

m

8

1- or 2-digit minutes

mm

08

2-digit zero-padded minutes

s

7

1- or 2-digit seconds

ss

07

2-digit zero-padded seconds

t

1

1- or 2-digit hours (12 hour clock)

tt

01

2-digit zero-padded hours (12 hour clock)

p

PM

AM or PM as appropriate

a

pm

am or pm as appropriate

z

PST

Time zone name

o

-0800

Time zone offset (from UTC)

The first month, week and quarter of a year is 1, and the first day of a month is also 1. Any combination of letters not specified here is an error, and any non-letter character is inserted literally.