show data and time as per user timeformat and date format and timezone

Ketan Pandey
Tera Expert

HI,

 

I have a UI page ,  which has GRID table, This grid table has below,I want to show the BookStartDateTime  and BookEndDateTime value  as per user timezone and dateformat and timeformat

 

Username

BookStartDateTime

BookEndDateTime

1 ACCEPTED SOLUTION

@Ketan Pandey 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

6 REPLIES 6

AnveshKumar M
Tera Sage
Tera Sage

Hi @Ketan Pandey ,

 

If you use getDisplayValue() method on the BookStartDateTime and BookEndDateTime fields, ServiceNow will automatically convert it to the User Date Time format as per his preferences.

 

Please let me know if you have any difficulties using this, share the code block where you are getting these values to help you with the exact code.

 

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

Thanks,
Anvesh

Thank You Anvesh, This helped.

 

One issue i am facing, Time is not showing 24 hour format

Hi @Ketan Pandey ,

I'm glad this helped, 24 Hr issue @Ankur Bawiskar  sir already answered.

 

Please mark my answer helpful and accept as solution if it helped you 👍✔️ (You can mark any number of answers as solution)

 

Thanks,
Anvesh

Ankur Bawiskar
Tera Patron
Tera Patron

@Ketan Pandey 

to show value as per logged in user you should use getDisplayValue() wherever date/time is shown

by default it's 24 hour format. Did you check somebody updated the system property to show in 12 hour format?

glide.sys.time_format -> this will impact entire instance

Properly setting an instance to 12-hour format 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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