Date and time formats

Token
Description
Example

YY

Year: 2 digits

21

YYYY

Year: 4 digits

2021

M

Month: 1 or 2 digits

1 … 12

Mo

Month: ordinal

1st … 12th

MM

Month: 2 digits

01 … 12

MMM

Month: 3 characters

Feb

MMMM

Month: full name

February

D

Day: 1 or 2 digits

1 … 31

Do

Day: 1 or 2 digits, ordinal

1st … 31st

DD

Day: 2 digits

01 … 31

d

Day: in a week as number (0-6)

0 … 6

do

Day: ordinal in week

0th ... 6th

dd

Weekday: 2 characters

Mo … Su

ddd

Weekday: 3 characters

Mon … Sun

dddd

Weekday: full name

Friday

w or W

Year: calendar week

1 … 53

Q

Year: quarter

1 … 4

l

Lowercase "L" - M/D/YYYY

6/15/2021

L

Uppercase "L" - MM/DD/YYYY

06/15/2021

h

Hour: 1 or 2 digits (12 h)

1 … 12

hh

Hour: 2 digits (12 h)

01 … 12

H

Hour: 1 or 2 digits (24 h)

0 … 23

HH

Hour: 2 digits (24 h)

00 ... 23

a

Hour: am or pm

hh:mm a = 11:30 pm (23:30)

m

Minute: 1 or 2 digits

0 … 59

mm

Minute: 2 digits

00 … 59

s

Second: 1 or 2 digits

0 … 59

ss

Second: 2 digits

00 … 59

x

Unix time: in milliseconds

April 8, 2021 - 9:11:58 GMT = 1617873118285

X

Unix time

April 8, 2021 - 9:11:58 GMT = 1617873118

Z

Time zone offset from UTC

-04:00:00

Last updated