Nayan Mahato
Tera Guru

Converting DateTime field to another time zone-

Use function convertTimeZone();-

*****************

var expectedTimezoneDateTime=new GlideScheduleDateTime().convertTimeZone("CET","GMT");

//You can provide a hardcoded value as well in the function GlideScheduleDateTime("02-02-2022 03:40:67");

var convertedTimeZoneDateTime= new GlideDateTime(expectedTimezoneDateTime);

gs.print(convertedTimeZoneDateTime);

Comments
Rajiv Handa
ServiceNow Employee
ServiceNow Employee

But sadly to say, this just returns the date-time in the user display format and not the internal format. We have to make that conversion explicitly.

Pranali18
Tera Expert

Hi @Nayan Mahato 

I'm using the same API as mentioned, it is getting converted when tried on background script but when event triggers and mapped value then it always showing same time that is 01:00:00.

Please advice.

Thanks

Version history
Last update:
‎03-08-2022 02:39 PM
Updated by: