計算兩個NSDate之間,相隔多少秒數
//兩個時間間隔秒數
- (NSInteger)intervalSecondsWithSmallDate:(NSDate*)smallDate bigDate:(NSDate*)bigDate
{
NSCalendar *calendar =[NSCalendar currentCalendar];
unsigned int unitFlags =kCFCalendarUnitYear|kCFCalendarUnitMonth|kCFCalendarUnitDay|kCFCalendarUnitHour|kCFCalendarUnitMinute|kCFCalendarUnitSecond;
NSDateComponents *dateComp= [calendar components:unitFlags fromDate:smallDate toDate:bigDate options:0];
NSInteger second = [dateComp hour]*3600+[dateComp minute]*60+[dateComp second];
return second;
}