How to get DateTime fields on forms to display the user's timezone?

alexjyong
Giga Contributor

A request from members in my organization involves displaying the timezone in the date time fields on our forms. While I could just have the label be dynamically generated by the user's timezone, it would be easier to just go and have it in the field itself.   Is there a way to do this? I know emailing the data shows timezone, but I would like it on the SN frontend as well.

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Alex,



So you want to display the name of timezone besides date/time field on form?


This seems difficult but can be achieved using client script by setting the message besides the field. This is the only way it can be done seems so.



Display Field Messages - ServiceNow Wiki



The system will show the date/time in user's timezone.



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Chuck Tomasi
Tera Patron

Hi Alex,



By default, the system uses the user's timezone, if it is set, to display times and dates. Make sure they go to their profile and set the timezone. It may be defaulting to "System timezone" (or similar).



Example: The dates in the system database are stored in UTC. When it displays on the browser, it applies the system timezone. If the user sets a timezone in their profile, that overrides the system timezone.


Right, but I want it to explicitly state the timezone within the field.



On the picture below, I want that field to show the timezone.



Screen Shot 2017-10-25 at 10.54.45 AM.png


Alex Yong wrote:



Right, but I want it to explicitly state the timezone within the field.


.. you mean state the viewing user's timezone?