Question about REST API query using sys_created_on

Bajeet
Kilo Contributor

I have this record:

{ "u_implemented": "false", "number": "INNO003008", "sys_id": "36745829db0223004c53d426ca9619b6", "u_description": "Sune Boye Riis was on a bike ride with his youngest son, enjoying the sun slanting over the fields and woodlands near their home north of Copenhagen, when it suddenly occurred to him that something about the experience was amiss. Specifically, something was missing.\r\n\r\nIt was summer. He was out in the country, moving fast. But strangely, he wasn't eating any bugs.", "u_idea_type": "process improvement", "sys_updated_by": "admin", "sys_created_on": "2018-11-27 22:02:32", "sys_mod_count": "1", "sys_updated_on": "2018-11-27 22:03:05", "sys_tags": "", "u_string_2": "The Insect Apocalypse Is Here What does it mean for the rest of life on Earth?", "sys_created_by": "admin" }

When I send this as the sysparm_query, it doesn't return the above record:

`sys_updated_on>javascript:gs.dateGenerate('2018-11-27','22:02:00')^ORsys_created_on>javascript:gs.dateGenerate('2018-11-27','22:02:00')^ORDERBYDESCsys_created_on`

Is there a problem with my query? The record has a `sys_created_on` value of "2018-11-27 22:02:32" and a `sys_updated_on` value of "2018-11-27 22:03:05". Shouldn't that be returned by the above query?

1 ACCEPTED SOLUTION

Best option will be is to set UTC time zone on service account (user record) that you are going to use for REST calls.

View solution in original post

11 REPLIES 11

Thanks Mike!

Dan87
Tera Contributor

@Mike PatelLet's say we don't have control over service account and we cant specify the timezone.

How we should query in that case?

sys_created_on>=javascript&colon;gs.dateGenerate('2024-10-28','18:25:01')^sys_created_on<javascript&colon;gs.dateGenerate('2024-10-28','18:30:01')^ORDERBYDESCsys_created_on

will this be considered as UTC time and all the results returned will show UTC time for sys_created_on filed?