I'm trying to compare two days of NSDate objects, I first used NSDateComponents to calculate the difference between my two date objects, but it works correctly.
NSString *dateStr =@"2012-11-05 15:00:00"; NSDate *date = [dateFormat dateFromString:dateStr]; NSDateComponents *datesDiff = [calendar components: NSDayCalendarUnit fromDate: date toDate: [NSDate date] options: 0];
This will not solve my problem. Indeed, when date1 = 2012-11-05 23:00:00 and date2 = 2012-11-06 10:00:00, the difference between the tow dates is 0 days and 11 hours. I am looking for something that allows me to detect changes in the day, in other words, when date1 = 2012-11-05 23:00:00 and date2 = 2012-11-06 00:01:00, there is one day diffrence.
If anyone knows a solution for this, I would welcome his suggestion. thanks in advance
ios nsdate
Ali Nov 05 2018-12-12T00: 00Z
source share