Covert time based on timezone

var tz = Packages.java.util.TimeZone.getTimeZone(‘US/Alaska’);
var tz1 = Packages.java.util.TimeZone.getTimeZone(‘US/Eastern’);
gs.print(tz);
gs.print(tz1);
var time = new GlideDateTime();
gs.print(time.getDisplayValue()); //2018–05–25 10:58:52
time.setTZ(tz);
gs.print(time.getDisplayValue()); // US/Alaska : 2018–05–24 21:28:52
time.setTZ(tz1);
gs.print(time.getDisplayValue()); // US/Eastern : 2018–05–25 01:28:52

Get user current timezone

var session = gs.getSession();
var zoneName = session.getTimeZoneName();
//OR You Can Apply
gs.getUser().getTZ();

Total Views: 1255

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *