Format date and time for workdays

Hi folks,
I’m currently looking for a solution for the following case.

I want to set a reminder for a call, so that an employee gets this reminder in his google calender 24 hours before the call starts.

For this I have to use the “date and time functions” and say “addHours(Call-Date; -24)”.

How can I make sure, that this function also takes into account the working days? In Germany, normal employees only work from monday-friday.

I want to avoid, that if the call-date is on monday, the employee gets the reminder on sunday. In This case, the reminder should be set to friday.

Can somebody help?

Thanks!

1 Like

Hi @m_m

Please try below formula and replace {{now}} with your actual variable
{{if(formatDate(addHours(now; -24); “MMMM”) = “Sunday”; addHours(now; -72); addHours(now; -24))}}

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation

3 Likes

Hi, thanks for your help. This formulare doesn’t work. Can you explain the formular for me briefly?

Edit:
replace “MMMM” with “dddd”

Welcome to the Make community!

Yes, that is possible. You’ll need to use various built-in functions:

Screenshot_2025-03-21_090358

e.g.: (paste this into the field and replace the mapped variables)

{{addDays(11.date; ifempty(switch(formatDate(11.date; "ddd"); "Sun"; -2; "Sat"; -1); 0))}} 

This is just an example. Your final solution may or may not look like this depending on your requirements.

For more information, see Date Format links below.

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

Getting Started

Help Centre Basics

Articles & Videos

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

1 Like

Demo

I have created a demo for you to try it out!

Example Dates

Output

Module Export - quick import into your scenario

You can copy and paste this module export into your scenario. This will import the modules (with fields/settings/filters) shown in my screenshots above.

  1. Move your mouse over the line of code below. Copy the JSON by clicking the copy button on the right of the code, which looks like this:

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (the paste keyboard shortcut for Windows) to paste directly in the editor.

  3. Click on each imported module and re-save it for validation. There may be some errors prompting you to remap some variables and connections.

JSON module export below — paste this directly in your scenario editor

{"subflows":[{"flow":[{"id":184,"module":"util:SetVariables","version":1,"parameters":{},"mapper":{"variables":[{"name":"date_on_wednesday","value":"{{setDay(now; \"Wednesday\")}}"},{"name":"date_on_saturday","value":"{{setDay(now; \"Saturday\")}}"},{"name":"date_on_sunday","value":"{{setDay(now; \"Sunday\")}}"}],"scope":"roundtrip"},"metadata":{"designer":{"x":837,"y":265,"name":"Example Dates"}}},{"id":185,"module":"util:SetVariables","version":1,"parameters":{},"mapper":{"variables":[{"name":"new_wed_date","value":"{{addDays(184.date_on_wednesday; ifempty(switch(formatDate(184.date_on_wednesday; \"ddd\"); \"Sun\"; -2; \"Sat\"; -1); 0))}}"},{"name":"new_sat_date","value":"{{addDays(184.date_on_saturday; ifempty(switch(formatDate(184.date_on_saturday; \"ddd\"); \"Sun\"; -2; \"Sat\"; -1); 0))}}"},{"name":"new_sun_date","value":"{{addDays(184.date_on_sunday; ifempty(switch(formatDate(184.date_on_sunday; \"ddd\"); \"Sun\"; -2; \"Sat\"; -1); 0))}}"}],"scope":"roundtrip"},"metadata":{"designer":{"x":1082,"y":267,"name":"Avoid Weekends!"}}}]}],"metadata":{"version":1}}

Note: Did you know you can reduce the size of blueprints and module export code like the above, using the Make Blueprint Scrubber?

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

2 Likes