Formatting Dates

  • Updated

There are numerous ways to format dates. We have a flexible system that is able to accommodate most date formats.

Today's Date

The variable {todaysDate} will generate today’s date.

Time Function

In order to format the date, we will be using the time function.

Let’s assume that today is June 5, 2020.

We can simply use time without any additional formatting.

Example Code

Result

{todaysDate | time}

2020-06-05

We can also format the date using the following syntax:

Syntax

Description

Example

M

Month number

1,2,…11,12

MM

Month number with leading 0

01, 02,…11,12

MMM

Abbreviated month to 3 letters

Jan, Feb,…Nov, Dec

MMMM

Full month name

January, February,…November, December

YY

Abbreviated year to last 2 digits

90, 91…19, 20

YYYY

Full year

1990, 1991,…2019, 2020

D

Day number

1, 2,…30, 31

DD

Day number with leading 0

01, 02,…30, 31

dddd

Day of the week

Monday, Tuesday,…Saturday, Sunday

do

Ordinal day

1st, 2nd…30th, 31st

DDD

Day of the year

1, 2, 3,…364, 365

DDDo

Ordinal day of the year

1st, 2nd…364th, 365th

The date syntax is case sensitive. This means that you must make sure that the formatting is upper or lowercase in accordance with the table above.

You can insert words and symbols within the time function using square brackets [].

Example Code

Output

{todaysDate | time}

2020-06-05

{electedDate | time:'dddd [the] Do [of] MMMM'}

Friday the 5th of June

{todaysDate | time:'Do [day of] MMMM[,] YYYY'}

5th day of June, 2020