AnsweredAssumed Answered

Using where clause to query date ranges in ArcPy

Question asked by Geoffrey.West on Apr 6, 2015
Latest reply on Apr 6, 2015 by xander_bakker

I would like to query a feature classes date range. For instance, if there is data within a 2 day range then I would like to print true or do something else. I thought arcpy.Exist would do the job, but I am missing something here. I guess my arcpy.Exist is only seeing if the variable exists, how would I check to see if the actual where clause is True for my feature layer?

 

 

query = arcpy.MakeFeatureLayer_management(fc, "QueryLayer", """Date BETWEEN '2014-02-16 16:53:25' AND '2014-02-17 18:53:25'""")


try:
  query

finally:
  
if arcpy.Exists(query):
       
print "true"
  
else:
       
print "no data"

Outcomes