About date of addtional comment

yuchen zhang
Tera Contributor

Hello, everyone.
I tried to modify the display time of addtional comment(employee center) to look like YYYY-MM-DD hh:mm:ss. But it shows international standard time and I want it to show local time.
I am new to making widgets, so I hope you could give me some tips.

Thanks in advance.

yuchenzhang_0-1700013683879.png

yuchenzhang_1-1700013715207.png

 

1 REPLY 1

AnveshKumar M
Tera Sage
Tera Sage

Hi @yuchen zhang 

 

You need to use getDisplayValue instead of getValue in your server side code to display the date time in user time zone.

 

If you don't have control over this in your server script, you can create a widget which takes time stamp as an option and converts it to user display time using GlideDateTime API and prints back.

 

And you can use the widget as an embedded widget. Refer the following link for embedded widgets in HTML template with option schema.

 

https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/build/service-portal/concept/c_Nes...

 

Please mark my answer helpful and accept as solution if it helped 👍

 

Thanks,
Anvesh