Select to view content in your preferred language

time filtering in ArcGIS API for Python

359
1
09-15-2022 09:09 PM
WPG03WPG03
New Contributor II

I am trying to query the layer by using time for filtering,

ref:(https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html#featurelayer

ArcGIS API for Python -> arcgis.features module -> FeatureLayer -> query()

)

It is tried that the datetime of all return data from query() are +00:00,

is there a way to set timezone in the query? May be in sql-92 where clause, arcgis online session configuration to set timezone, or other ways to filter (e.g. time_filter option in query(), tried but seems failed to specify the datetime field), etc..

0 Kudos
1 Reply
jcarlson
MVP Esteemed Contributor

Sorry, but what's the problem here? Is it that you want to query with a different time zone, or that the time filtering isn't working somehow? When you submit a query, it will read it in on your local time.

From the REST API docs (emphasis added):

For example, if you want to return all the records that match 1:00 p.m. on February 9, 2015, Pacific standard time, your WHERE clause would be as follows:

 
where=pacific_time_date_field = DATE '2015-02-09 13:00:00'

Although you issue local time in your WHERE clause, this operation always returns date values in UTC.

- Josh Carlson
Kendall County GIS
0 Kudos