In transform map need to convert UTC to EST time
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2016 09:12 AM
How to convert UTC Time to EST time?
- function getLocalDate() {
- var gdt = new GlideDateTime(); // Without input sets it to current UTC.
- //gs.log(gdt); *** Script: 2015-02-28 02:08:41 (UTC).
- var timeZoneOffSet = gdt.getTZOffset();
- //gs.log(timeZoneOffSet); *** Script: -18000000 (milliseconds). -5 Hours offset (EST)
- gdt.setNumericValue(gdt.getNumericValue() + timeZoneOffSet); //EST
- return gdt;
- }
This code will use current UTC time and convert to EST.
I need a input to set for UTC (dynamic input ) expecting output as EST
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2016 09:14 AM
Hi Sankeerth,
Just pass your date/time as a parameter to new GlideDateTime().
See section 3.2 here.
GlideDateTime - ServiceNow Wiki

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2016 09:15 AM
Hi Sankeerth,
You may find the below link helpful.
Re: Convert UTC to Time Zone (US/Eastern) from GlideRecord query output
http://wiki.servicenow.com/index.php?title=Using_Time_Zones