Date and Time Functions

In this guide, we’ll explore the date and time functions available in Make.com. These functions will help you format dates, calculate time differences, work with time zones, and more. Understanding these functions will help you handle date and time values in your scenarios like a pro! 😉

Ready to master time manipulation? ⏳

Introduction to Date and Time Functions

This is what the mapping panel looks like for the date and time functions:

Just like with math functions, you’ll find these sections in the mapping panel:

  • Calendar: Select a specific date and time.
  • Variables: Pre-built variables for current date, now, etc.
  • Functions: Handy ways to format, add, or subtract time.

Click on each to add them to your field in a module or filter.

The basics

Types of functions

There are three types of functions;

  1. Formatting & parsing dates; understand and change the format of a date.
  2. Add to dates; add or subtract time from a date.
  3. Set dates; change for example only the year or month of a date.

Tokens

Something you will also see often in the guide below are tokens, which represent specific parts of a date or time to format it in different ways;

  • YYYY represents a 4-digit year.
  • MM represents the month with leading zeros (e.g., 01 for January).
  • DD represents the day of the month with leading zeros (e.g., 09 for the 9th day).

Take a look at the complete overview of tokens.

Standard date-time format

What you’ll also see often is a date format like 2024-10-10T16:07:10.000Z, which is a ISO 8601 date-time format that your scenarios in Make.com work with;

  • 2024-10-10 for the date (year-month-day).
  • T as a separator between the date and time.
  • 16:07:10.000 for the time (hours:minutes.milliseconds).
  • Z indicating that the time is in UTC (Coordinated Universal Time).

You don’t really have to know how to write that format, but just so you know what it means.

timestamp (variable)

The timestamp variable will return a unix timestamp.

A Unix timestamp counts the number of seconds that have passed since January 1, 1970, which is used as a standard reference point for measuring time in computing.

timestamp

= 1728576430

This is the unix timestamp for the 10th of October 2024 at 16:07 (UTC)🙂

now (variable)

The now variable will return the current date & time in your timezone.

You can check the timezone of your account by going to Profile » Time Zone Options.

now

= 10th October 2024 16:07

In this article I will use the current date & time in UTC whenever you see me use it.

All Date and Time Functions Explained

formatDate

formatDate() converts a date value into a text value in a format that you specify.

For example, we can convert now to a text value of only the year by using the YYYY token;

formatDate(now;YYYY)

= 2024

Or here we’re using YYYY-MM-DD HH:mm to convert the date to a text with the date and time in 24-hour format.

formatDate(now;YYYY-MM-DD HH:mm)

= 2024-10-10 16:07

You don’t have to use the now variable of course, that’s just an example, you can also use a fixed date or an item with a date value in it.

formatDate(2003-12-10T12:50:10.000Z;YYYY-MM-DD HH:mm)

= 2003-12-10 12:50

formatDate(1.appointment_date;YYYY-MM-DD HH:mm)

= 2024-10-10 16:07

See? 😄

You can find all the tokens like YYYY, MM, DD, HH, mm, and many more on the tokens page.

I especially like dddd to get the day name.

formatDate(now;dddd)

= Thursday

Or to write the current date in a more human way in for example an email.

Today is the formatDate(now;Do) of formatDate(now;MMMM).

= Today is the 10th of October.

And if you want, you can also format it to another timezone.

By default it uses the timezone that your account is in, but you can convert it too another timezone is you want like this;

formatDate(now;YYYY-MM-DD HH:mm;Australia/Canberra)

= 2024-10-11 03:07

formatDate(now;YYYY-MM-DD HH:mm;Europe/Amsterdam)

= 2024-10-10 18:07

Make sure to use the TZ identifier for that timezone, otherwise it will throw an error.

parseDate

The parseDate() function is handy to convert a text value into a date value that your scenario understands.

Lets say we have the text “2024-10-10“, without us explain to Make.com what format it is in, it will not know what to do with it.

parseDate(2024-10-10;YYYY-MM-DD)

= 2024-10-10T00:00:00.000Z

As you can see, we receive this long format in ISO 8601, which computers can easily understand.

Here are a few examples where also time is included;

parseDate(2024-10-10 16:07;YYYY-MM-DD HH:mm)

= 2024-10-10T16:07:00.000Z

parseDate(2024-10-10 04:07 pm;YYYY-MM-DD hh:mm a)

= 2024-10-10T04:07:00.000Z

If necessary, you can also specify the timezone the date is in by adding the TZ identifier.

parseDate(2024-10-10 04:07 pm;YYYY-MM-DD hh:mm a;Europe/Amsterdam)

= 2024-10-10T16:07:00.000Z

And now that Make.com understands the date you gave it, you can use all the functions below and/or format it with the formatDate() function.

addYears

This one adds or subtracts years from your date value. Use addYears() to calculate birthdays or future dates.

addYears(now;20)

= 2044-10-10T16:07:10.000Z

So we added 20 years to 2024 and got 2044.

addMonths

The addMonths() function adds or subtracts months from a Date.

addMonths(now;2)

= 2024-12-10T16:07:10.000Z

The current month is October but now we added 2 months and the date & time changed to make sure it’s December.

addDays

addDays() adds or subtracts days from a given Date.

addDays(now;3)

= 2024-10-13T16:07:10.000Z

In this example, it simply added 3 days to the current date & time.

addHours

addHours() adds or subtracts hours from a Date value.

addHours(now;5)

= 2024-10-10T21:07:10.000Z

You can add as many hours as you like.

addHours(now;48)

= 2024-10-12T16:07:10.000Z

addMinutes

addMinutes() lets you adjust the minutes of a Date value. You can add or subtract.

addMinutes(now;10)

= 2024-10-10T16:17:10.000Z

addMinutes(now;-10)

= 2024-10-10T15:57:10.000Z

addSeconds

addSeconds() lets you add or subtract seconds from a Date value.

addSeconds(now;30)

= 2024-10-10T16:07:40.000Z

We simply added 30 seconds to this date & time.

setYear

The setYear() function changes just the year of your Date value.

setYear(now;2055)

= 2055-10-10T16:07:10.000Z

So here, 2024 became 2055.

setMonth

The setMonth() function sets the month of a date value.

setMonth(now;11)

= 2024-11-10T16:07:10.000Z

Instead of numbers, you can also use the English name of the month.

setMonth(now;November)

= 2024-11-10T16:07:10.000Z

setDate

setDate() lets you modify the day of the month with a number from 1 to 31.

setDate(now;12)

= 2024-10-12T16:07:10.000Z

But you can also give a number lower than 1 or greater than 31, it will then simply get the day for the previous or next month.

setDate(now;32)

= 2024-11-01T16:07:10.000Z

setDay

setDay() lets you adjust the day of the week (Sunday is 1, Saturday is 7).

setDay(now;5)

= 2024-10-10T16:07:10.000Z

setHour

Use setHour() to change the hour in a Date value.

setHour(now;7)

= 2024-10-10T07:07:10.000Z

setMinute

setMinute() modifies the minute of a Date value.

setMinute(now;55)

= 2024-10-10T16:55:10.000Z

setSecond

setSecond() sets the seconds of a Date value.

setSecond(now;17)

= 2024-10-10T16:07:17.000Z

Examples using multiple functions

Add 2 years and 5 days to current date

If you need a date 2 years and 5 days ahead;

formatDate(addDays(addYears(now;2);5);YYYY-MM-DD)

= 2026-10-15

We first add 2 days to the current date, then 5 years to that, and then we format it to YYYY-MM-DD.

Add future date to email

Imagine you have generated a coupon that’s valid for three days.

To create of urgency, you want to mention the date the coupon is expiring in.

To do that, we are going to use the now variable, add 3 days with the addDays() function and format it with the formatDate() function.

The coupon is expiring the formatDate(addDays(now;3);Do) of formatDate(addDays(now;3);MMMM).

= The coupon is expiring the 13th of October.

See how it added 3 days in the text? Today is the 10th of October and we used the addDays() function to change it to the 13th of October.

Cool, right? 😄

Get the 1st of next month

Maybe you want to get the date for the 1st of next month, for example, for a meeting or a subscription renewal.

Here’s how you do that:

setDate(addMonths(now;1);1)

= 2024-11-01T16:07:10.000Z

We used addMonths() to add 1 month, and then used setDate() to get the 1st of that month.

Want to use it in a nice format? No problem.

formatDate(setDate(addMonths(now;1);1);Do of MMMM)

= 1st of November

Get my best tips for Make.com 🧙‍♂️

Practical & fun automation tips that are easy to implement in your online business

    * No spam, ever.

    Become a Make.com expert

    Learn how to save hours a week in your online business fast

    Tell me more about the course! 🔥