How to query Table with UTC timestamp?

Shaan2
Tera Contributor

How to query using Table API but with UTC timestamp? 

I'm making a request to the Table API like so:

https://<domain-name>.service-now.com/api/now/table/kb_use?sys_created_on>javascript:gs.dateGenerate('2022-05-16','15:56:00')&sysparm_limit=100

But the time param in the query is being considered in the local time zone, what else should I pass so that it gets considered as UTC time? (I don't want to convert to local time)

9 REPLIES 9

sachin_namjoshi
Kilo Patron
Kilo Patron

You can pass  sysparm_input_display_value = false in your REST payload.

For date and time fields, when this parameter is true the date and time value is inserted adjusted for the current user's timezone. When false, the date and time value is inserted using the UTC timezone.

 

Regards,

Sachin

Shaan2
Tera Contributor

I'm not inserting anything but querying values from the table, so the parameter is not doing anything for me. e.g. local time where I am is 15:49 PDT and the time I want to pass is 15:56 UTC but the API is treating it as a PDT time and so I'm not seeing any results.

 

Hi,

Pass the argument as sysparm_display_value=false and it returns you the value in UTC format.

Ref: https://developer.servicenow.com/dev.do#!/reference/api/sandiego/rest/c_TableAPI

find_real_file.png

 

Mark the comment as a correct answer and also helpful if this has answered the question.

asifnoor
Kilo Patron

Hi,

Pass the argument as sysparm_display_value=false and it returns you the value in UTC format.

Ref: https://developer.servicenow.com/dev.do#!/reference/api/sandiego/rest/c_TableAPI

find_real_file.png

 

Mark the comment as a correct answer and also helpful if this has answered the question.