Date/time Formatting

Date/time formats use Numbers notation rather than POSIX strftime as there are a number of extensions. Date components are specified using directives which must be separated by whitespace. Supported directives are:

Directive

Meaning

Example

a

Locale’s AM or PM

am, pm

EEEE

Full weekday name

Monday, Tuesday, …

EEE

Abbreviated weekday name

Mon, Tue, …

yyyy

Year with century as a decimal number

1999, 2023, etc.

yy

Year without century as a zero-padded decimal number

00, 01, … 99

y

Year without century as a decimal number

0, 1, … 99

MMMM

Full month name

January, February, …

MMM

Abbreviated month name

Jan, Feb, …

MM

Month as a zero-padded decimal number

01, 02, … 12

M

Month as a decimal number

1, 2, … 12

d

Day as a decimal number

1, 2, … 31

dd

Day as a zero-padded decimal number

01, 02, … 31

DDD

Day of the year as a zero-padded 3-digit number

001 - 366

DD

Day of the year as a minimum zero-padded 2-digit number

01 - 366

D

Day of the year

1 - 366

HH

Hour (24-hour clock) as a zero-padded decimal number

00, 01, … 23

H

Hour (24-hour clock) as a decimal number

0, 1, … 23

hh

Hour (12-hour clock) as a zero-padded decimal number

01, 02, … 12

h

Hour (12-hour clock) as a decimal number

1, 2, … 12

k

Hour (24-hour clock) as a decimal number to 24

1, 2, … 24

kk

Hour (24-hour clock) as a zero-padded decimal number to 24

01, 02, … 24

K

Hour (12-hour clock) as a decimal number from 0

0, 1, … 11

KK

Hour (12-hour clock) as a zero-padded decimal number from 0

00, 01, … 11

mm

Minutes as a zero-padded number

00, 01, … 59

m

Minutes as a number

0, 1, … 59

ss

Seconds as a zero-padded number

00, 01, … 59

s

Seconds as a number

0, 1, … 59

W

Week number in the month (first week is zero)

0, 1, … 5

ww

Week number of the year (Monday as the first day of the week)

0, 1, … 53

G

AD or BC (only AD is supported)

AD

F

How many times the day of falls in the month

1, 2, … 5

S

Seconds to one decimal place

0 - 9

SS

Seconds to two decimal places

00 - 99

SSS

Seconds to three decimal places

000 - 999

SSSS

Seconds to four decimal places

0000 - 9999

SSSSS

Seconds to five decimal places

00000 - 9999