Change Timezone Of Date/Time Field While Transforming

ayush_saxena
Tera Expert

Hello All,

Hope you are doing fine. While performing E bonding Integration between two Service Now instances I encountered with an Time zone issue.

Issue is the other Service Now system runs on CST time zone and uses MM/dd/yyyy hh:mm:ss format where as my system runs on PST Timezone and uses YYYY-DD-MM hh:mm:ss format.

The format can be converted easily while Transforming but the timezone remains CST.

I tried below script and getting Answer   gdt.setTZ(tz) as undefined.

var tz = gs.getSession().getTimeZone();

var val = source.start_date;

var gdt = new GlideDateTime(val);

var ntZ= gdt.setTZ(tz);

gs.log(' Answer   gdt.setTZ(tz) == ' + ntZ);

Is it I am not utilizing it efficiently? Please assist

Thanks and Regards,

Ayush Saxena

5 REPLIES 5

Yes var tz has the expected value, even   i am getting correct value in source and gdt it is jut TZ() not working