- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 03:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 03:09 AM
hI @t venkatesh1 ,
There is a field Called Time zone in user table which hold the timezone of that user so you can try adding the below code in your script.
var gr = new GlideRecord('sys_user');
gr.get(gs.getUserID());
gs.info('Time Zone '+ gr.time_zone);
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 03:19 AM - edited 05-20-2024 03:20 AM
Thanks for the quick response, i am not sure it will works in script include.
i want to check two situations one is if user time zone = universal(default date is showing correct) or else user time zone is Japan(one day back date it is showing) need to add utc +9. in this two scenarios how to define the script to validate the user time zone?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 11:53 AM
This should work in script include because if you check in your system property -> Basic configuration there the timezone will be set for user so, same will be captured in sys_user table Time zone field so based on your condition you can use it in your script include,
let me know if you need help with the coding and please share whatever you tried or you have configured?
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 02:29 PM
Hi @t venkatesh1,
Are you trying to set a fixed display value for the date variable across all time zones?
If so, you don't need to write a script to validate the user's timezone.
Instead, try something like this:
javascript: var gdt = new GlideDate(); gdt.setDisplayValue("2021-05-21");gdt.getValue();
Of course, you will need to change the parameter in the setDisplayValue() to fit your needs.
Cheers