Time Zone client script

cpinedatx94
Tera Expert

Im trying to write a client script which takes my current time and a current choice from a choice field ive named (Timezone) and then calculate the time difference based on the zone (Pacific, Atlantic, Central etc) and add or substract the difference to get the Eastern Time zone for it,

 

Example:

Local Time field: 8:00 AM (Then I select "Central" in the next field")

Time Zone: Central

Auto calculates +2 Hours and spits out

Eastern: 10:00AM

 

I currently have all the current USA time zones as choices. 

1 REPLY 1

Abhishek M
Kilo Guru

Hi @cpinedatx94 ,

 

There are few OOB methods to convert your time to specific timezone, Please refer below articles, if it sync with your requirement

 

Handling Time-Zones in ServiceNow (TimeZoneUtils) 

Demystifying GlideDateTime and Timezones, also convert dates to different timezones