Skip to content

#datetime

The #datetime Data Helper can be used in templates to output date and time fields in a defined format.

Used on it’s own, the helper will output the current date and time according to when the template’s generated.

For example:

HelperOutputFormat
{{#datetime}}Today’s date30 May 2018
{{#datetime ‘MMMM Do’}}Today’s dateMay 30th
{{#datetime ‘Do MMMM YYYY [at] h:mma’}}Today’s date and time30th May 2018 at 3:15pm

The helper can also be used in conjunction with Data Markers of the Date or Date/Time type to configure the format of the output.

For example:

HelperOutputFormat
{{#datetime completion.date}}The matters completion date12 October 2021
{{#datetime ‘MMMM Do’ completion date}}The matters completion dateOctober 12th
{{#datetime ‘Do MMMM YYYY [at] h:mma’ completion.date}}The matters completion date and time12 th October 2021 at 12:00pm

Use the below coding to format your output:

InputOutputFormat
YYYY4 digit year2014
YY2 digit year14
MMonth number2
MMMonth number with leading zero to ensure 2 digits02
MMM3 letter abbreviation of month nameJan
MMMMMonth nameJanuary
DDate of the month1
DDDate of the month with leading zero to ensure 2 digits01
DoDate of the month with ordinal1st
DDD3 letter abbreviation of the day nameMon
DDDDDay nameMonday
hHour7
hhHour with leading zero to ensure 2 digits07
mmMinute with leading zero to ensure 2 digits05
AAM or PMAM
aam or pmam

Make use of symbols and text within the helper to further configure the output:

InputFormat
{{#datetime ‘D/M/YY’}}1/8/21
{{#datetime ‘DD-MM-YYYY’}}01-08-2021
{{#datetime ‘dddd [the] Do [of] MMMM YYYY’}}Sunday the 01st of August 2021
{{#datetime ‘hh:mmA’}}02:30PM