How can we convert IST time to PST
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2016 04:35 PM
Hi All,
I was trying to convert IST time to PST ,any function available ?
Ex:
Input Time 2016-06-29 11:00:00 (IST)
OutPut : 2016-06-28 22:30:00 (PST)
I tried glide time object but they give GMT and then i have to manually add some additional minutes to get required result..
I was looking for a function like
ChangeTIme(Input time)
{
Code//
Return RequiredTime;
}
Any help will be appreciated..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2016 04:40 PM
Hi Sam,
Go to https://developer.servicenow.com and search for GlideDateTime. There's a method called setTZ().
It takes a Timzone object, which can be retrieved with with getUserTimeZone(). I don't know what happens if you feed it something like
America/Los_Angeles
You could try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2019 04:18 AM
Hi Sam,
There is a global script include: rmconverttimezone. Use this to convert from any time zone to other:
gs.print(rmConvertTimeZone('2019-02-27 11:44:52','UTC','US/Pacific'));
If you will use packages.java.util.timeZone......it's not considered best practice to use Java packages directly in ServiceNow code. Though the above function also uses the same, since that's out of the box so you will be saved.
Thanks
Rajiv Handa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2023 09:33 PM
Rmconverttimezone is a global script inclusion. Use this to convert between any two time zones:
gs.print ("2019-02-27 11:44:52", "UTC", "US/Pacific");");
Using Java packages directly in ServiceNow code is not regarded as best practice, even if you use packages.java.util.timeZone. Although the aforementioned feature likewise makes use of the same, you will be spared because it comes pre-installed.