Trying to determine current date and time to process a scenario

Hi,

I’m trying to configure my scenario to execute based on 2 filters. First filter will be Business Hours and second is Outside Business Hours. Business hours will be from 9am - 5pm Monday - Friday. Outside of that will be outside business hours.

I have defined the current day & time via tools

The output is correct, which is (current day & time) Wednesday 15:27

My ‘open’ (business hours) filter is set to this:

But it isn’t accepting it

image

I have also tried it this way but it passes every single time when it is not supposed to…

Please help, this is driving me crazy haha

You shouldn’t be using a text variable at all to compare dates. If you want you should compare a date type against another date type, or a numeric value against another numeric value. You are also using formatDate to return too many portions of the date, you should reduce the format to output only the current hour, or day of week.

Under scheduling you can set an advanced schedule to process the scenario, by clicking the clock icon on the lower left of the first module/trigger, then click the “Show advanced settings” toggle.

Look, isn’t this much easier?:

For more information, see Schedule setting panel

Hope this helps!

3 Likes

If you want to do branching from a router, you don’t even need to set a variable first. Just use now directly, but make it return “hour of day” and “day of week” using a single date token:

Screenshot_2023-08-23_150803

And add a fallback route for anything outside your defined business hours

3 Likes

This router solution is exactly what I needed. Thank you SO MUCH!!

2 Likes