How to convert GMT Date/Time format into IST Format?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2020 10:59 PM
How to convert GMT Date/Time format into IST Format?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 10:34 PM
Hi David,
Hi, It's bcoz your system timezone is ist. So while storing it is converting to ist. If you don't want that conversion then in our earlier code, Just change this line and uncomment the other lines.
Packages.java.util.TimeZone.getTimeZone("IST"); //sets to IST TO
Packages.java.util.TimeZone.getTimeZone("GMT"); //sets to GMT and check.
Please Mark it Correct/Helpful if it Help you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 10:44 PM
Hey David,
You can also try this:
setTZ(TimeZone timeZone)
Sets the time zone of the GlideDateTime object to be the specified time zone.
var tz = gs.getSession().getTimeZone();
var gdt = new GlideDateTime();
gdt.setTZ(tz);
Here are the same threads that you looking for it might helps you:
Kindly Mark Correct if this solves your issue and also mark Helpful if you find my response worthy!
Best Regards,
Namrata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 10:46 PM
Hey David,
try below code,
In Script Include, Try adding below code to validate the date/time in logged in user timezone.
var tz = gs.getSession().getTimeZone();
var gdt = new GlideDateTime();
gdt.setTZ(tz);
var diff = gs.dateDiff(gdt, "catalog variable Value which you pass from client script through glide ajax", true);
if(diff < 0){
return false;
}
You can refer below threads as well
Please mark as Correct Answer and Helpful, if applicable.
Regards,
Indrajit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 10:46 PM
Hi David,
ServiceNow internally stores date/time in GMT format only; any specific requirement to convert it to IST?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader