Using runtime date fields as a query parameter

Discussion created by mikedmanak on Jan 29, 2015
Latest reply on Jan 10, 2017 by forrestkaye

I was having trouble filtering data from a runtime geodatabase based on date fields (not using a time-aware database).  I finally figured it out:



The quick-and-dirty version is that you need to do string comparisons of your date field and whatever NSDate variable you want to compare against, like this:

query.whereClause = [NSString stringWithFormat:@"strftime('%%Y-%%m-%%d %%H:%%M:%%S', DateTime) >= '%@'", [Utility returnStringFromDate:mapViewController.filterDate withDateFormat:@"yyyy-MM-dd 00:00:00 +0000"]];


[Utility returnStringFromDate: withDateFormat:] is just a wrapper for an NSDateFormatter and string conversion function.