Time Conversion between timezone

Ranjit Nimbalka
Mega Sage

I have an requirement basically i need script which will convert 9AM UTC time to equivalent to different time zones.

Lets say user having time zone as "Europe" so need there time when UTC time is 9AM. we have lot of time zones so script should run for all based on user time zone.

 

Thanks

5 REPLIES 5

Krushna R Birla
Kilo Sage

Hi @Ranjit Nimbalka 

 

You can use below script to set TZ as per current logged in user TZ

 

var session = gs.getSession();
var zoneName = session.getTimeZoneName();
var str = JSON.stringify(zoneName);

var tmpTime = new GlideDateTime();
tmpTime.setTimeZone(str);
gs.print("Date Time as per current user TZ: " + tmpTime.getDisplayValue());

 

If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.

 

Best Regards,
Krushna Birla