I need to compair current time with two time rang, its work fine in every case but when I check “12:00 PM” to “01:30 PM”, it give me wrong value.
NSComparisonResult timeStart=[@"01:02 PM" compare:@"12:00 PM"];
NSComparisonResult timeEnd=[@"01:02 PM" compare:@"01:30 PM"];
both timeStart and timeEnd are -1?
where timeStart is bigger so it should be 1 which is not.
Please help……
You are comparing two strings, not two times. You need to first construct
NSDateobjects with sayNSDateFormatter‘sdateFromString:method, then do your comparison.