getDisplayValue() of a date/time field is giving wrong values

Debasis Pati
Tera Guru

if the date is below

 then getDisplayValue is giving  2021-07-03 13:00:00

 

 

@Ankur Bawiskar @Harshvardhan 

Please help

Regards,

Debasis

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Debasis Pati 

getDisplayValue() will always print the value as per user's timezone or the timezone present in the user settings.

Can you explain where you are using that and what is not working?

Regards
Ankur

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

View solution in original post

14 REPLIES 14

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Can you share how you are using it? Also where?

Please provide some more info.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi Mark,

I am using it in a schedeule script and for doing some functionalities i am just fething the date/tome field present in incident field.

Below is the code

var copy= inc.u_copy_updated.getDisplayValue();

gs.log("Copy Value"+copy)

 

 

Hi,

if you wish to copy date/time value from 1 field to another then do this to set the value internally in GMT always

var copy = inc.u_copy_updated;

gr.setValue('u_field', copy);

Regards
Ankur

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

Hi Ankur,

I want get the date/time field value and want to add 24 hours to the time and then want to set the time to next field

but when i am using this getDisplayValue it is only giving me wrong value

 

Please help.!!!

 

Regards,

Debasis