Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Alternate to Packages.java.util.TimeZone.getTimeZone("Australia/Sydney");

Uttam Sai
Tera Expert

Hi All,

 

Is  it good practice to use Packages.java.util.TimeZone.getTimeZone. If not, could you please let me know the alternatives we can use in ServiceNow scripts to convert timezone.

 

Thank you

Uttam Sai S

1 REPLY 1

SVimes
Mega Sage

I've used the following in a mail script before which works perfectly for me.

 

var convertToCentralStart = global.rmConvertTimeZone(current.getDisplayValue('start_date') + " " + current.getDisplayValue('start_time'),"America/Los_Angeles","US/Central");

 

 

The packages option you are asking about is not wrong to use though. I'm just offering an alternative if that does not work in your favor.

Sable Vimes - CSA | CIS-DF | CIS-ITSM