Date field is changing based on user profile timezone but we need to restrict that field based customized time zone field on form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2019 09:51 PM
Hi
We have custom Time zone field and custom field on form.
if different time zone user open same record date field converting automatically to based on user profile time zone how to restrict automatic date display
but is has to show always based on custom timezone field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2019 10:13 PM
Hi,
It is OOB functionality of Service Now to override the date based on user setting.
If you do not want an override to happen, then you need to do the conversion of the date/time into the custom Timezone that you want and show it there.
Here is sample code on how to convert to custom timezone.
var myDate = "2011-08-31 08:00:00"; //change to your dynamic value here.
var gdt = new GlideDateTime();
var tz = Packages.java.util.TimeZone.getTimeZone("IST"); //Change to your custom timezone.
gdt.setTZ(tz);
gdt.setValue(new GlideDateTime(myDate));
return gdt.getDisplayValue(); //This will return the date in your custom timezone.
Mark the comment as a correct answer and helpful if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2019 01:59 AM
its setting the value but correctly but when am saying the record its change the value

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2019 05:09 AM
When you option the form again, after saving, aren't you seeing the data that it was set before?
What is the difference? is it the timezone difference or the entire date is wrong.