I am trying to select records within a specified date range from a file geodatabase feature class using an sql query but am having a hard time getting the syntax correct. I have tried numerous ways but at this point am getting no records returned. The last couple of versions of the query I have tried are as follows:
whereClause = """'{0}' > '{1}' AND '{0}' < '{2}'""".format(arcpy.AddFieldDelimiters(fcMaster, "date"), '2016-10-02 02:30:00', '2016-10-05 02:30:00')
whereClause = """'{0}' BETWEEN '{1}' AND '{2}'""".format(arcpy.AddFieldDelimiters(fcMaster, "date"), 'date 2016-10-02 02:30:00', 'date 2016-10-05 00:02:30')
AddFieldDelimiters
, don't wrap{0}
in quotes -- the function handles that for you if your data source changes.print whereclause
to see what python is using.