Is there any way to query the REST API using UTC dates?

Terry Olsen
Kilo Explorer

I have the following query string trying to get all updated work orders since the last time I pulled.

sysparm_query=sys_updated_on>=javascript:gs.dateGenerate('2019-08-06','19:53:06')

The API provides the sys_updated_on as UTC. But the only way I can get that record is if I convert the UTC time that I want to local time:

sysparm_query=sys_updated_on>=javascript:gs.dateGenerate('2019-08-06','15:53:06')

How can I make it so I can use UTC time in my query and not have to convert it to local time?

2 REPLIES 2

Ct111
Tera Sage

Hi Terry,

 

Please check the below link

https://community.servicenow.com/community?id=community_question&sys_id=72998ba5db5cdbc01dcaf3231f96...

 

here information regarding how to achieve UTC is given.

 

Mark my ANSWER as CORRECT and HELPFUL if it helped.

MikeB3
Tera Contributor

Rest is using the timezone at the endpoint to convert it. If you can try setting your REST user/service account to the UTC or GMT as it's timezone. Submitted query's will then always be considered as UTC irrespective of the endpoints timezone.