Need to Set Time for scheduled job based on time_zone in cmn_location table.

VikramM1
Tera Contributor

How to get time based on the display value of timezone field in cmn_location table.

 

I am running one schedule job periodically and set time zone based on IST with below code. But i want to set timezone based on Timezone field in cmn_location table. Can someone provide me the code to set time based on timezone available in timezone field.

 

var gdt = new GlideDateTime();
        var gdt1 = new GlideDateTime();
        var tz = Packages.java.util.TimeZone.getTimeZone("IST"); // sets to IST
        gdt1.setTZ(tz);
        gdt1.setValue(gdt);
        var time= gdt1.getDisplayValueInternal(); // Use getDisplayValueInternal() for 24-hour format
        time= new GlideDateTime(start);
1 ACCEPTED SOLUTION
5 REPLIES 5