
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2019 07:44 PM
Hi all,
I would like to display date field for every global user.
For example, if Japanese users see a data field A as 2019-02-11 in the Japanese morning,
At the same time I would like US users to see a date field A as 2019-02-10 in the US evening.
I know date/Time field is automatically calculate time in the database and display according to their local timezone. ( For example, update and created field.)
Best regards,
Tomoaki
Solved! Go to Solution.
- Labels:
-
Best Practices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2019 11:18 PM
var datetime = new GlideDateTime();
datetime.getDisplayValue() ---> This will give you what you need. The same date but in the current user's timezone.
You can use this link for more info.
https://www.linkedin.com/pulse/working-dates-servicenow-mrigank-gupta/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2019 08:18 PM
You are correct. Service platform will show the date field after converting it to current user's timezone.
This should resolve your issue. Or do you want to show the same date field in different time zone in same form at same time?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2019 10:47 PM
Hi Mrigank,
Thank you for your replying, but as you thought, I was not able to resolve my issue.
I fill my date type field with script below, but not converted to each user's timezone.
Where is bad point?
(function executeRule(current, previous /*null when async*/) {
var datetime = new GlideDateTime();
current.u_answer_date = datetime.getDate();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 04:15 PM
var datetime = new GlideDateTime();
current.u_answer_date = datetime.getDate();
This will only get the UTC timezone because of the functionality of SN
var datetime = new GlideDateTime().getLocalDate();
current.u_answer_date = datetime;
For your requirement this fits your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2019 11:18 PM
var datetime = new GlideDateTime();
datetime.getDisplayValue() ---> This will give you what you need. The same date but in the current user's timezone.
You can use this link for more info.
https://www.linkedin.com/pulse/working-dates-servicenow-mrigank-gupta/