extract current time from [%CurrentDateTime%] and compare

Hi all, Is there any good suggestions to extract current hours (+minutes ) from the variable [%CurrentDateTime%]  in a microflow? I want to compare the current time to specific time to make a decision in microflow, say it’s 5a.m. in the morning and admin doesn’t want user to see the screen at the time, “User cannot login before 7a.m.”   Found this one below in the Docs, but seems I cannot use the method in a microflow… https://docs.mendix.com/refguide/xpath-hours-from-datetime#1-overview     What method should I use? Thank you in Advance. Regards, Yuki
2 answers

For your example, you could create an expression that looks like this:

[%CurrentDateTime%] > addHours([%BeginOfCurrentDay%], 7)

Which will evaluate true after 7am

The ‘problem’ with the the CurrentDateTime token: they will normally use the time zone of the server which is UTC. So if you want to be very specific about the current timezone and change to DST some moment, you will need some custom logic that will check the correct times based on the correct timezone.

You can then use [%BeginOfCurrentDayUTC%] to add or distract the correct amount of hours.


Ruuds answer is spot on how to do comparisons on available data in a microflow. 

Please note that XPath is used for queries in the retrieve activity, page datasources etc.