Compare two NSDates
问题 How can I compare two NSDates and return the amount of time between them. For example: 2010-06-20 14:29:41 -0400 2010-06-20 14:53:29 -0400 should return something like: 23 or 24 (minutes), rounding the seconds because I don't really need the seconds. 回答1: try something like: int intervall = (int) [date1 timeIntervalSinceDate: date2] / 60; 回答2: Here the complete snippet to compare two NSDate which you may find more useful based on your query. NSCalendar *myCal = [[NSCalendar alloc]