Reputation: 201
I want compare two dates one would be the current date and other date stored in database. So I want to find out which date is grater from both.
Upvotes: 2
Views: 3416
Reputation: 10011
You can use compare:
method to find which date is earlier or later check the documentation on this
Edit:
NSDateFormatter * formatter= [NSDateFormatter alloc] init];
NSDate *date = [formatter dateFromString:stringDate];
[formatter release];
then compare them.
Upvotes: 0
Reputation: 13807
You can use the compare method of the NSDate class
[myDate compare:someOtherDate]
This will return one of three values of type NSComparisonResult...
Upvotes: 4
Reputation: 15115
Check apple documentation.
You can use the following methods,
– isEqualToDate:
– earlierDate:
– laterDate:
– compare:
Upvotes: 3