How to query ArcGIS feature layer's date type column using epoch time format

603
1
08-03-2023 02:18 PM
celliott
New Contributor

Hey all, I was wondering if it was possible to perform a query on a DATE type column for an ArcGIS feature layer using an epoch time format.

For example this query works fine:

 

DATE =  '7/28/2023 12:00:00 AM'

 

But when using epoch time that matches the date above, it does not return any results:

 

DATE = 1690520400000

 

What's also slightly confusing too is when I set the return format type to "JSON" for the ArcGIS REST Services directory when querying the feature layer, the DATE field is actually returning an epoch timestamp instead of the date string seen when the return format type is set to "HTML", so I would have imagined it would be possible to use epoch time for these queries.

Did not see anything regarding the ability to use epoch timestamps for these queries in the documentation, so perhaps it's just not possible or I'm missing something here?

0 Kudos
1 Reply
SteveCole
Frequent Contributor

Maybe you have to convert the format of the Epoch value something like

DATEADD(s, 1624705077, '1970-01-01 00:00:00')

So you're REST query would be something like

DATE = DATEADD(s, 1624705077, '1970-01-01 00:00:00')

SQL allows for some functions and operators within the actual SQL string so I wonder if this is one of those situations...

Steve

0 Kudos