Issue with Timezone conversion with day light saving .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2017 04:05 AM
Hello Experts ,
We are working on a requirement where in we are converting User profile time zone to "US/Pacific" to be shown on some pages.
Packages.java.util.TimeZone.getTimeZone("US/Pacific") can convert the timezone to the time zone specified , but will it apply the day light saving also ?
Servicenow automatically applies Day light saving if the timezone mentioned Issue with the name of the place/country and not the timezone name.
As we cant ensure that every user profile timezone will be set to name of country/places , we need to have a logic which applies the day light saving while evaluating the time in the script.
would appreciate your help on this .
Thanks in advance .
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2017 04:55 PM
Hi Sandeep,
The wiki says:
For example US/Pacific is a link to the America/Los_Angeles time zone. Both America/Los_Angeles and US/Pacific represent Pacific Standard Time with the same zone offset and Daylight Savings Time (DST) schedule.
Using Time Zones - ServiceNow Wiki
So it looks like all the timezones like US/Pacific, US/Central, US/Eastern and so on will take account of daylight savings changes. The only ones that won't take account of daylight savings would be the 3-letter codes for specific timezones - PST, UTC etc. If it's possible, the best way to solve this would be to remove these from the choice list and check your User[sys_user] table to ensure no users are using these: Using Time Zones - ServiceNow Wiki
Another possibility would be to check for these 3-letter timezones in your code, but then you'd need to have a hard-coded mapping to translate them into the location-based timezones. E.g. 'PST'->'US/Pacific'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2019 10:12 AM
Hi ,
Did you find any logic that converts timezones including daylight saving?