Time Zone client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 06:45 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2024 08:19 AM
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