Articles in this section

Handlebar expressions for date and time format codes

integrator.io uses the moment.js JavaScript library to handle time and date formatting. The following table lists all available codes:

Note

Results are based on the following timeStamp: 2020-07-09T19:59:39.156Z

Category

Token

Description

Handlebars expression

Result

Month

M

1 through 12 no padding (no leading "0")

{{{dateFormat "M" timeStamp}}}

7

Mo

1st through 12th no padding + ordinal (th, st, etc.)

{{{dateFormat "Mo" timeStamp}}}

7th

MM

01 through 12 two digit

{{{dateFormat "MM" timeStamp}}}

07

MMM

Jan through Dec Three letter abbreviation

{{{dateFormat "MMM" timeStamp}}}

Jul

MMMM

January through December Full month name

{{{dateFormat "MMMM" timeStamp}}}

July

Quarter

Q

1 through 4 Quarter Year: quarter

{{{dateFormat "Q" timeStamp}}}

3

Qo

1st through 4th Quarter + ordinal.

{{{dateFormat "Qo" timeStamp}}}

3rd

Day of month

D

1 through 31 no padding

{{{dateFormat "D" timeStamp}}}

9

Do

1st through 31st no padding + ordinal

{{{dateFormat "Do" timeStamp}}}

9th

DD

01 through 31 2 digit (will have a leading "0" for first nine days)

{{{dateFormat "DD" timeStamp}}}

09

Day of year

DDD

1 through 365 no padding (no leading "0")

{{{dateFormat "DDD" timeStamp}}}

191

DDDo

1st through 365th no padding + ordinal

{{{dateFormat "DDDo" timeStamp}}}

191st

DDDD

001 through 365 3 digit (will have leading "0s" for 1st-99th)

{{{dateFormat "DDDD" timeStamp}}}

191

Day of week

d

0 through 6 no padding

{{{dateFormat "d" timeStamp}}}

4

do

0th through 6th no padding + ordinal

{{{dateFormat "do" timeStamp}}}

4th

dd

Su through Sa 2 letter abbreviation

{{{dateFormat "dd" timeStamp}}}

Th

ddd

Sun through Sat 3 letter abbreviation

{{{dateFormat "ddd" timeStamp}}}

Thu

dddd

Sunday through Saturday full day name

{{{dateFormat "dddd" timeStamp}}}

Thursday

Day of week (locale)

e

0 through 6 This allows you to set the first day of the week if Sunday (default) is not preferred.

{{{dateFormat "e" timeStamp}}}

4

Day of week (ISO)

E

1 through 7 This is eliminates the zero-based default.

{{{dateFormat "E" timeStamp}}}

4

Week of year

w

1 through 53 no padding

{{{dateFormat "W" timeStamp}}}

28

wo

1st through 53rd no padding + ordinal

{{{dateFormat "Wo" timeStamp}}}

28th

ww

01 through 53 2 digit (leading "0" for weeks 1 through 9)

{{{dateFormat "WW" timeStamp}}}

28

Year

YY

2 digit

{{{dateFormat "YY" timeStamp}}}

20

YYYY

4 digit

{{{dateFormat "YYYY" timeStamp}}}

2020

Y

4 digit (complies with ISO 8601 standard for dates past the year 9999)

{{{dateFormat "Y" timeStamp}}}

2020

Week year

gg

2 digits

{{{dateFormat "gg" timeStamp}}}

20

gggg

4 digits

{{{dateFormat "gggg" timeStamp}}}

2020

Week year (ISO)

GG

2 digits

{{{dateFormat "GG" timeStamp}}}

20

GGGG

4 digits

{{{dateFormat "GGGG" timeStamp}}}

2020

AM/PM

A

AM PM (uppercase)

{{{dateFormat "A" timeStamp}}}

PM

a

am pm (lowercase)

{{{dateFormat "a" timeStamp}}}

pm

Hour

H

no padding 24 hour clock (0-23)

{{{dateFormat "H" timeStamp}}}

19

HH

2 digits 24 hour clock (00-23)

{{{dateFormat "HH" timeStamp}}}

19

h

no padding 12 hour clock (1-12)

{{{dateFormat "h" timeStamp}}}

7

hh

2 digits 12 hour clock (01-12)

{{{dateFormat "hh" timeStamp}}}

07

k

no padding 24 hour clock (1-24)

{{{dateFormat "k" timeStamp}}}

19

kk

2 digit 24 hour clock (01-24)

{{{dateFormat "kk" timeStamp}}}

29

Minute

m

no padding

{{{dateFormat "m" timeStamp}}}

59

mm

2 digits (leading "0" for 1-9).

{{{dateFormat "mm" timeStamp}}}

59

Second

s

no padding

{{{dateFormat "s" timeStamp}}}

39

ss

2 digits (leading "0" for 1-9)

{{{dateFormat "ss" timeStamp}}}

39

Fractional second

S

1 digit (no padding)

{{{dateFormat "S" timeStamp}}}

1

SS

2 digits (00-99)

{{{dateFormat "SS" timeStamp}}}

16

SSS

3 digits (000-999)

{{{dateFormat "SSS" timeStamp}}}

161

SSSS

through

SSSSSSSSS

Additional "S" will pad the fractional seconds with trailing zeroes.

{{{dateFormat "SSSS [...] SSSSSSSSS" timeStamp}}}

1610 ... 161000000

Time zone offset

Z

colon separated

{{{dateFormat "Z" timeStamp}}}

+00:00

ZZ

no colon

{{{dateFormat "ZZ" timeStamp}}}

+0000

Unix timestamp

X

standard

{{{dateFormat "X" timeStamp}}}

1594324779

Unix millisecond timestamp

x

Unix timestamp with milliseconds

{{{dateFormat "x" timeStamp}}}

1594324779162

Localized formats

LT

Time: 8:30 PM

{{{dateFormat "LT" timeStamp}}}

7:59 PM

LTS

Time with seconds: 8:30:33 PM

{{{dateFormat "LTS" timeStamp}}}

7:59:39 PM

L

09/04/2020

{{{dateFormat "L" timeStamp}}}

07/09/2020

l

9/4/2020

{{{dateFormat "l" timeStamp}}}

7/9/2020

LL

September 4, 1986

{{{dateFormat "LL" timeStamp}}}

July 9, 2020

ll

Sep 4, 1986

{{{dateFormat "ll" timeStamp}}}

Jul 9, 2020

LLL

September 4, 1986 8:30 PM

{{{dateFormat "LLL" timeStamp}}}

July 9, 2020 7:59 PM

lll

Sep 4, 1986 8:30 PM

{{{dateFormat "lll" timeStamp}}}

Jul 9, 2020 7:59 PM

LLLL

Thursday, September 4, 1986 8:30 PM

{{{dateFormat "LLLL" timeStamp}}}

Thursday, July 9, 2020 7:59 PM

llll

Thu, Sep 4, 1986 8:30 PM

{{{dateFormat "llll" timeStamp}}}

Thu, Jul 9, 2020 7:59 PM

Square brackets

[some text]

add characters

{{{dateFormat "YYYY-MM-DD [Have Fun!]" timeStamp}}}

2020-07-09 Have Fun!

Was this article helpful?
2 out of 6 found this helpful

Comments

0 comments

Please sign in to leave a comment.