Flow Designer condition using current time executes in UTC causing incorrect comparison with time

kumarakshay
Tera Contributor

Hello Experts,

We are trying to implement logic in Flow Designer for Visitor Management.

Requirement:
If the visitor's Expected Departure time has passed the current time, then we need to update an Overdue flag in the Visitor Registration record.

Current implementation:
We created a Flow Designer condition that checks whether Expected Departure is at or after the current minute.

Issue:
We noticed that the Flow seems to evaluate the time in UTC, while the Expected Departure value is being interpreted based on the user/session time zone. Because of this, the condition evaluates incorrectly and the Overdue flag is set to true earlier than expected.



Questions:

  1. Is this expected behavior for Flow Designer time comparisons?
  2. What is the recommended way to compare Date/Time fields with the current time in Flow Designer when time zones are involved?
  3. Is there a configuration or best practice to handle this within Flow Designer conditions?

Any guidance or recommended implementation pattern would be appreciated.

 

@_raj_esh @Arvid 

1 REPLY 1

Naveen20
ServiceNow Employee

 

This is expected behavior. Flow Designer conditions evaluate Date/Time fields in UTC internally, but the "current time" dynamic value and display can be influenced by the session/user time zone, causing mismatches in comparisons.

Recommended approach: Replace the Flow Designer condition with a Script Step (Run Script action) where you explicitly control the comparison in UTC:

var now = new GlideDateTime(); // always UTC
var departure = new GlideDateTime(fd_data.trigger.current.expected_departure); // stored UTC

outputs.is_overdue = (departure.compareTo(now) < 0);

Both GlideDateTime values will be in UTC, eliminating the timezone discrepancy. Use the is_overdue output as a condition for your subsequent Update Record step.

Why this works: ServiceNow stores all Date/Time fields in UTC in the database. The mismatch you're seeing happens because Flow Designer's built-in condition builder can apply timezone conversion on display values before comparing. A Script Step with GlideDateTime bypasses that layer entirely and compares raw UTC-to-UTC.

Alternative (no-code): If you want to stay condition-based, convert your Expected Departure to a duration/offset using a Script Step first (e.g., calculate the difference in seconds between departure and now), then use a simple numeric condition like difference <= 0 to flag overdue. This keeps the condition logic visual while the timezone math stays in script.