Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Understand GlideDateTime in flow action scripts and output variables - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Understand GlideDateTime in flow action scripts and output variables
KB0812370

Understand GlideDateTime in flow action scripts and output variables


5689 Views Last updated : Aug 27, 2025 public Copy Permalink
KB Summary by Now Assist

Issue

In a flow action, when a GlideDateTime object is stored in a local variable and passed as an output variable of String type or Date/Time, the flow execution details page displays the date/time in the user's time zone instead of in UTC format (Coordinated Universal Time). 

The following code in a flow action script section demonstrates the issue:

(function execute(inputs, outputs) {
// ... code ...
var current_datetime = new GlideDateTime();
outputs.current_datetime = current_datetime; 
outputs.current_datetime_in_datetime = current_datetime; 
gs.log("*** GlideDateTime object *** " + current_datetime);
})(inputs, outputs);

In this example, current_datetime is an output variable of type String and current_datetime_in_datetime is an output variable of type Date/Time

After the flow execution, the date/time appears differently.

In the system log: 

*** GlideDateTime object *** 2020-01-22 01:53:30 // in UTC 

On the flow execution details page:

current_datetime 21-01-2020 17:53:30 // in User's timezone
current_datetime_in_datetime 21-01-2020 17:53:30 // in User's timezone

Release

All supported releases

Cause

The flow execution details page displays date/time using the GlideDateTime.getDisplayValue() method, which shows date/time in the user's time zone. 

Resolution

To display date/time in UTC on the flow execution details page, use the GlideDateTime.getValue() method in your script.

Modify your script as follows:

(function execute(inputs, outputs) {
// ... code ...
var current_datetime = new GlideDateTime();
outputs.current_datetime = current_datetime.getValue(); 
outputs.current_datetime_in_datetime = current_datetime.getValue(); 
gs.log("*** GlideDateTime object *** " + current_datetime);
})(inputs, outputs);

After flow execution, the date/time appears consistently:

In the system log:

*** GlideDateTime object *** 2020-01-22 01:53:30 // in UTC 

On the flow execution details page:

current_datetime 2020-01-22 01:53:30 // in UTC
current_datetime_in_datetime 2020-01-22 01:53:30 // in UTC

Related Links

For more about GlideDateTime API and methods, see the product documentation, GlideDateTime - Global


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.