How to execute macro only between specific times

Hi, I’m trying to execute a macro only when it’s between 22:00 and 23:59. I’ve looked at some date/time discussion but my nose started to bleed;-) I thought I could use an If/Then statement, then use a this Environment variable but I don’t know if TIME is an variable that KM understand and don’t know how to enter the time in the is > field. Any help appreciate!
Thanks!

Hi Jeff,

TIME() is indeed a variable (or more precisely, a function) that KM understands, but in your case, it sounds like you want HOUR():

Check Current Hour.kmactions (1.4 KB)

This way, the macro can check if the current hour is 22 or 23 (which covers all the minutes from 22:00 to 23:59) and only proceed with the macro if it is. I hope this helps!

1 Like

Thanks gglick, works great for my purpose.

1 Like