Converting dates in Make(formerly Integromat)
Learn how to format dates in Make (formerly Integromat)
Handling dates in Make(formerly Integromat)
Knowledge Level: Advanced
When working with webhooks, you will come across scenarios where you are using dates. Dates are handled in two ways via The Bot Platform:
- The webhook contains a unix timestamp which represents the time at which the webhook was inititated
- bot user inputs date which is captured through an attribute in the platform and passed on through a webhook.
In the below steps, we will demonstrate a few examples which you can use to convert dates to various different formats using Make(formerly Integromat).
Converting unix timestamp to human readable format
Let's see this example below. We have a webhook with the 'timestamp' in Unix time format:
Note: A unix time stamp is a way to track the time as a running total of seconds, this count starts at the Unix Epoch on January 1st, 1970 at UTC.
To convert this to a date in human readable format, we will use one of Make(formerly Integromat) date operator.
You will find these operators when adding webhook data to another data point such as a Google Sheet.
For conversion, the formula will look like this:
Using the 'fomratDate' operator, we parse the 'timestamp' from our webhook and define an output format.
In this case, we used the format 'DD/MM/YYY' as output.
When the scenario runs successfully, the output in your Google Sheet will show as below:
Add or subtract days in Make(formerly Integromat)
Similar to the above scenario, we can perform calculations on a date entered by the bot user.
For example, we can add two days to a date entered by the bot user and submit the output to a Google sheet.
See example below:
In the above example, we first formatted the date to our preferred format i.e DD/MM/YYY, after formatting we used the operator 'addDays' to add two additional days to the actual date.
Our output in Google Sheet can be seen below:
Updated 6 months ago