We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

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

@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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

working fine, thank you for your help !!

I have accepted the solution and marked it as helpful also