When you send dates from one system to another via Make, the date from the original system may not be in a human friendly format. Therefore, you may want to change the date format to something that is easier for human’s to read and understand. You can do that using the formatDate()
function.
An example
I recently synced dates from Recurly to an email marketing system, and the client wanted a specific date format in the email marketing system so that they could use it in the emails sent to customers.
By default, Recurly will return dates in a date format like so: 2021-05-25T07:49:33Z
. Not exactly human friendly if you are using these in emails to customers! The format they wanted was 17th August 2023
.
I used the formatDate() function as follows, to format it as 17th August 2023
:
{{formatDate(2.body.data[].current_period_ends_at; "Do MMMM YYYY")}}
This is how it looks in Make:
The formatDate() function takes two parameters:
- The date value
- The date format you want to use
In this case, the date value is from Recurly and will be returned by 2.body.data[].current_period_ends_at
.
The date format I want is:
- Do: Day of month with ordinal. E.g. 1st, 2nd, 17th
- MMMM: Month name, E.g. August
- YYYY: 4 digit year, E.g. 2023
This will ensure that 2021-08-17T07:49:33Z
is formatted as 17th August 2023
.
More examples
The table below is some of the most common tokens that you might need.
Token | Example | Description |
---|---|---|
YY | 23 | Last 2 digits for year |
YYYY | 2023 | 4 digitals for year |
M | 9 | Month number |
MM | 09 | Month number with leading 0 |
MMMM | August | Month name |
D | 17 | Day |
Do | 17th | Day with ordinal |
DD | 01 | Day with leading zero |
dd | Sat | Day |
dddd | Saturday | Full day name |
Common date formats
See the Make documentation for the full list of token’s:
https://www.make.com/en/help/functions/tokens-for-date-time-formatting