- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 03:42 AM
In ServiceNow, g_form.getValue() returns the user’s display value for a Date/Time field. How can I retrieve the actual system (UTC) value of that field inside a Script Include?”
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 03:46 AM - edited 08-22-2025 03:46 AM
When you pass a display value into your Script Include, you should wrap it in a GlideDateTime object. Set that object’s display value to the one you received from the GlideAjax call.
Once the display value is set, you can safely use the server value (.getValue()) from the GlideDateTime object, which will return the UTC time.
This approach removes the need for manual conversions or lengthy scripts—the platform handles the conversion for you.
Using .getValue() would get you the server value, which is stored in UTC.
Using .getDisplayValue() would get you the display value of the field, which is set to your preference and timezone.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2025 03:46 AM - edited 08-22-2025 03:46 AM
When you pass a display value into your Script Include, you should wrap it in a GlideDateTime object. Set that object’s display value to the one you received from the GlideAjax call.
Once the display value is set, you can safely use the server value (.getValue()) from the GlideDateTime object, which will return the UTC time.
This approach removes the need for manual conversions or lengthy scripts—the platform handles the conversion for you.
Using .getValue() would get you the server value, which is stored in UTC.
Using .getDisplayValue() would get you the display value of the field, which is set to your preference and timezone.