Document toolboxDocument toolbox

1.5.1. Formatting dates

Unit

Token

Description & output

Unit

Token

Description & output

Year

YYYY

2018

 

YY

18

 

Y

2018

Quarter

Q

3

 

Qo

3rd

Month

MMMM

September

 

MMM

Sep

 

MM

09

 

Mo

9th

 

M

9

Week (iso)

WW

37 (2 digit, zero padded)

 

Wo

37th

 

W

37

 

WWp

Week 37 (localized prefix, zero pad)

 

Wp

Week 37 (localized prefix)

 

WWp0

W37 (localized prefix)

 

Wp0

W37 (localized prefix)

Date

DDDD

Day of year, 3 digits

 

DDDo

Day of year, ordinal

 

DDD

Day of year

 

DD

09

 

Do

9th

 

D

9

Weekday

dddd

Sunday

 

ddd

Sun

 

dd

Su

 

d1

S

 

do

0th

 

d

0

Hour

HH

18 (00 - 23)

 

H

18 (0 - 23)

 

hh

06 (00 - 12)

 

h

6 (0 - 12)

 

KK

19 (01 - 24)

 

K

19 (1 - 24)

 

kk

06 or 18, locale determines

 

k

6 or 18, locale determines

Minute

mm

07

 

m

7

Second

ss

08

 

s

8

Millisecond

S

1 (100ms)

 

SS

14 (140ms)

 

SSS

145 (145ms)

AM/PM

A

AM or PM

 

a

am or pm

Predefined

LT

H: 2-digit (2d), m: 2d

(uses browser locale)

LTS

H: 2d, m: 2d, s : 2d

 

LST

Depends on 12 or 24 hour clock

 

 

12h, H : 1d, m : 0 or 2d

 

 

24h, H : 2d, m : 2d

 

L

Y: numeric (n), M : 2d, D : 2d

 

l

Y: n, M : n, D : n

 

LL

Y: n, M : long (l), D : n

 

ll

Y: n, M : short (s), D : n

 

LLL

Y: n, M : l, D : n, H: n, m: 2d

 

lll

Y: n, M : s, D : n, H: n, m: 2d

 

LLLL

Y: n, M : l, D : n, H: n, m: 2d, d: l

 

llll

Y: n, M : s, D : n, H: n, m: 2d, d: s

 

u

YYYYMMDDZ in UTC zone

 

uu

YYYYMMDDTHHMMSSZ in UTC zone