At the start of a scenario, I set a filter to wipe a data store value if the current time is earlier than 08:16
The scenario is scheduled to start at 08:15 so the first execution should wipe the data store.
However, when I ran the scenario at 21:20, the filter passed and the data store value was wiped. I checked using a Set Variable module and it outputs 09:20. Shouldn’t the filter have failed?
Hey there,
put these two formulas in a Set Multiple Variables module and see what you get as results. Then check if these are the desired values you need to be checking against.
Cause when I put the second formula, I get 12:16 and 09:20 is definitely before that. I suggest you hardcode the second one and put the desired time directly and modify the first formula to consider AM and PM.
3 Likes
You formatted a string which did not have a timezone specified, so it defaults to UTC.
To prevent this, first use the parseDate function to convert the string into a date variable, before you use formatDate.
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
1 Like
I don’t understand why the time zone keeps getting switched back and forth when I combine parseDate() and formatDate() so I just did this instead: