#datetime
The #datetime Data Helper can be used in templates to output date and time fields in a defined format.
Today’s Date
Section titled “Today’s Date”Used on it’s own, the helper will output the current date and time according to when the template’s generated.
For example:
| Helper | Output | Format |
|---|---|---|
| {{#datetime}} | Today’s date | 30 May 2018 |
| {{#datetime ‘MMMM Do’}} | Today’s date | May 30th |
| {{#datetime ‘Do MMMM YYYY [at] h:mma’}} | Today’s date and time | 30th May 2018 at 3:15pm |
Custom Field Dates
Section titled “Custom Field Dates”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:
| Helper | Output | Format |
|---|---|---|
| {{#datetime completion.date}} | The matters completion date | 12 October 2021 |
| {{#datetime ‘MMMM Do’ completion date}} | The matters completion date | October 12th |
| {{#datetime ‘Do MMMM YYYY [at] h:mma’ completion.date}} | The matters completion date and time | 12 th October 2021 at 12:00pm |
Possible Formats
Section titled “Possible Formats”Use the below coding to format your output:
| Input | Output | Format |
|---|---|---|
| YYYY | 4 digit year | 2014 |
| YY | 2 digit year | 14 |
| M | Month number | 2 |
| MM | Month number with leading zero to ensure 2 digits | 02 |
| MMM | 3 letter abbreviation of month name | Jan |
| MMMM | Month name | January |
| D | Date of the month | 1 |
| DD | Date of the month with leading zero to ensure 2 digits | 01 |
| Do | Date of the month with ordinal | 1st |
| DDD | 3 letter abbreviation of the day name | Mon |
| DDDD | Day name | Monday |
| h | Hour | 7 |
| hh | Hour with leading zero to ensure 2 digits | 07 |
| mm | Minute with leading zero to ensure 2 digits | 05 |
| A | AM or PM | AM |
| a | am or pm | am |
Make use of symbols and text within the helper to further configure the output:
| Input | Format |
|---|---|
| {{#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 |