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

Yes.


You might be able to do something similar with your own formatter... You could use getUserTimeZone (or gs.getSession().getTimeZone() ) to get the value and then display it as a UI macro/formatter. It wouldn't be part of the field display itself, but would allow you to expose it.



https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_GDT-getUserTimeZone



https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/administer/form-administration/c...


I'll give that a shot. Thanks!


Ah, I see.



As far as I know, there's no format that outputs "PDT, UTC, US/Phoenix" or any other timezone suffix in the date/time picker widget. I love the idea.



If you feel this is important, I invite you to open an enhancement request! Our product managers DO listen.


Enhancement requests: Tell us how you would improve the ServiceNow product


Just tried to, but the enhancement form's product field is empty, which keeps me from submitting it. Screen Shot 2017-10-25 at 11.15.52 AM.png