Insert different Text - based on date

Hey guys,

I have the following question and I did not find a solution yet to fix it:

My standard text is: "Best regards".

Now I want to add a text, based on a specific time of my computer. On Monday between 4:00 - 12:00am I want to be the text: "Have a good start into the week! Best regards".

On Friday from 1:00 - 8:00pm, I would like to add: "Have a good upcoming weekend! Best regards".

I looked into the "If then else" action and the "switch/case", but I did not find the option for time stamp or date. Any work around, or anyone has a similar solution? I guess it can be possible with Java script?

Thanks in advance!

The ICU Date Time token can be configured to show just the current day of the week and hour (%ICUDateTime%EEE h%) so we can use that in conjunction with a simple regex to verify both the date and the hour in a Switch/Case action:

Insert Different Text Based on Date & Hour.kmmacros (2.6 KB)

1 Like

You can determine the Day of the Week with the DOW function and the hour with the HOUR function, and you can test them with the Calculation condition in the If Then Else action.

image

4 Likes

Thank you both so much, also for showing and explaining more functions!

1 Like