Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to convert GMT to user current time zone

shaik_irfan
Tera Guru

 

hi,

 

When i pull the updated on date i am getting in GMT time zone can anyone please help me how to convert that to local user time zone

1 ACCEPTED SOLUTION

you should use getDisplayValueInternal() method.

 

Note: it will return date and time values for the GlideDateTime object in the current user's time zone 

 

doc link for further details. 

 

https://developer.servicenow.com/dev.do#!/reference/api/orlando/server/no-namespace/c_APIRef#r_Scope...

 

 

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Shaik,

if you are in server side script; and want to get time in local user time zone then use

this would return value in user timezone

gr.<field>.getDisplayValue();

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

@Ankur Bawiskar 

 

On the incident record updated on field gives me the time in GMT time zone whcih i want to convert into user time zone like if the user is in PST or IST or EST based on his/her profile time zone set i want to display the date time 

 

Please advice

you should use getDisplayValueInternal() method.

 

Note: it will return date and time values for the GlideDateTime object in the current user's time zone 

 

doc link for further details. 

 

https://developer.servicenow.com/dev.do#!/reference/api/orlando/server/no-namespace/c_APIRef#r_Scope...

 

 

Hi Shaik,

Can you tell where you want to show this? is it on some info message on form?

Regards
Ankur

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