How to query Table with UTC timestamp?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 03:19 PM
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)
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 03:45 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 03:50 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 03:54 PM
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
Mark the comment as a correct answer and also helpful if this has answered the question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2022 04:13 PM
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
Mark the comment as a correct answer and also helpful if this has answered the question.