Convert date from CST to UTC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2020 07:22 AM
Hi, Guys there,
I need help in the Conversion of dates from CST to UTC. Tried couple of ways, but seems unreliable.
Can anyone help me the way to get CST date into UTC format ?
Below is the example and solution looking for,
var cstDate = "2020-07-24 09:10:00"; //CST time 9:10 AM.
var gdt = new GlideDateTime(cstDate);
gs.debug(gdt); //it prints 2020-07-24 09:10:00.
---------------------------------------------
Imagine CST to UTC has 6 hrs difference (may vary, sometimes 5, sometimes 6).
Imagine UTC to IST has 5.30 hrs difference (may vary).
Seeking for a solution which will return,
- '2020-07-24 15:10:00' if I am in UTC Timezone.
- '2020-07-24 20:40:00' if I am in IST Timezone.
In simple based on my current timezone.
PN: I am trying to get the solution being in the Scoped app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2020 09:08 AM
Hi,
I don't see any other method as of now.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2020 07:30 AM
Hi,
Check this page
https://snprotips.com/blog/2017/9/12/handling-timezones-in-servicenow-timezoneutil
-Anurag
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2020 08:48 AM
Hi,
Just checking to see if this is answered or not?
-Anurag
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2020 07:43 AM
Hi Anurag,
Thanks for the suggestion.
But, It could not resolve my issue, as I am trying to get the solution in Scoped App.
I cannot load timezone packages being in the Scoped app (I cannot make any changes to global scope).
Any other workaround I can get please.