Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Time difference when received date and time via SOAP request

Dinesh90
Tera Contributor

Hello @Ankur Bawiskar , @Dr Atul G- LNG  , @J Siva 

There is a time difference when setting the value in a field with type date and time.

In the SOAP request body, I have received the value (2025-05-27 09:00:00) (UTC timezone)

when I set this value in one of the field in ServiceNow , the time difference is of one hour - it is setting time as 08:00:00 instead of 09:00:00

User's profile is also having timezone as UTC but still 1 hour difference on the field.

Dinesh90_0-1748320593054.png

I am directly setting the value in the transform script like, fetching it from soap request payload and setting it to the field in servicenow

sn_task.u_pending_until = pendingUntil; // pendingUntil is the value I am fetched from the SOAP body.
sn_task.update();
 
Please let me know why this is happening and solution to resolve it ? what should I do to set the exact time I am receiving in the SOAP request. Please help with the sample script or solution.

FYI - Time zone is UTC (soap request body) and in ServiceNow user's profile time zone is also UTC but still 1 hour difference on the field.
 
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Dinesh90 

please use setValue() while setting so that it sets in GMT

In form or list it will display based on timezone of the user

something like this

sn_task.setValue('u_pending_until', pendingUntil); // pendingUntil is the value I am fetched from the SOAP body.
sn_task.update();

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

5 REPLIES 5

J Siva
Kilo Patron
Kilo Patron

Hi @Dinesh90 
What about the instance timezone? Instead of checking the user timezone, you need to verify the instance timezone, as scripts use the instance timezone rather than the logged-in user's timezone.

Regards,
Siva

Ankur Bawiskar
Tera Patron
Tera Patron

@Dinesh90 

please use setValue() while setting so that it sets in GMT

In form or list it will display based on timezone of the user

something like this

sn_task.setValue('u_pending_until', pendingUntil); // pendingUntil is the value I am fetched from the SOAP body.
sn_task.update();

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

Thank for your reply @Ankur Bawiskar 
I will try this but wants to check - GMT & UTC are same thing right ?

@Dinesh90 

yes both are same

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