Execute if time is between

I would like to make an if action (or similar) that only runs if I'm within normal business hours.
So it needs to evaluate if time is between 9-5, monday-friday.

Is this possible?

Thanks a lot!

Yup, it's possible:

Example Macro.kmmacros (1.7 KB)

Further reading:
DOW Function
Hour Function


So simple. Yet I would never have found out.

Thanks a lot for a quick answer! :slight_smile:

1 Like

I've been messing around with the DOW() calculation for some time now and while the HOUR() calculation works just fine, the DOW() calculation seems to return true no matter what day of the week it is. I'm using the exact macro I downloaded from here.

Any idea why?


The type of DOW() (i.e. the type of the value it returns) is an integer drawn from the set {1..7}

Any non-negative integer, if coerced to a Boolean {True, False} value, translates to True rather than False

Use a number as a conditional test value, for example, and it will be translated to False if that number is 0, but otherwise it will be translated to True.

Not sure why it should be this way, but I think the answer is to do the same thing with DOW() as with HOUR(), that is "1<DOW() AND DOW()<7"

I forgot all about the macro because it works so well now. Thanks a lot!