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-17-2022 09:14 AM
Hello Shaan,
If this has answered the question, kindly mark my comment as a correct answer so that the question is moved to the solved list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2022 10:40 AM
Hi!
The sysparm_display_value changes the display value of the records that are returned. What I actually need is a way to provide the time that I'm passing as a query parameter to be in UTC.
so for the sysparm_query parameter, the time I'm passing is being considered to be in the local time zone of the instance, but I want the query parameter to be considered in the UTC time zone.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 03:26 PM
Hi Shaan2,
The simplest solution would be to change the API user to have the UTC (GMT) timezone. I cannot see anything in GlideRecord (query) or Table API that lets you pass in anything other than user's current timezone.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 08:59 AM
you can use javascript:GlideDateTime that won't do any conversion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 03:04 AM
Facing the same issue here. Were you able to find a solution for your problem? In my case, I want to query based on the "sys_updated_on" field.
sys_updated_on>=javascript:gs.dateGenerate('2025-1-23', '5:30:27')
But it returns no results. This time value is in my local timezone (EST), while my sys_user/instance timezone is PST (EST - 3 hours). If I put the time value as '2:30:27', it works (my local time - 3 hours). So it seems this time needs to be sent to dateGenerate in the sys_user timezone.
Would be so much more convenient to be able to pass the time as GMT, since it seems the API stores the sys_updated_on value in GMT anyway. Did you find a solution/workaround?