IOS: problem with NSOrderedDescending and NSOrderedAscending
I want to compare dates and I use this code in one example date values for my date are: date1 = 6/06/2011 date2 = 8/06/2011 if dateSelected = 7/06/2011 it's all ok, but if dateSelected = 6/06/2011 or dateSelected = 8/06/2011 the code don't entry inside my "if", why??? if (([dateSelected compare:date1] == NSOrderedDescending) && ([dateSelected compare:date2]== NSOrderedAscending)) {} NSDates represent a point in time since 1/1/2000 00:00 UTC. So all of those dates have time components. -compare: compares date and time. Presumably, you really want to check if the date selected is between 6/6