NSDate *pastDate = ...;

NSDate *nowDate = [NSDate date]; NSCalendar *calendar = [NSCalendar currentCalendar]; NSUInteger calendarUnit = NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;


NSDateComponents *dateComp = [calendar components: calendarUnit fromDate: nowDate toDate: pastDate options:0]; NSInteger day = dateComp.day; NSInteger hour = dateComp.hour; NSInteger min = dateComp.minute; NSInteger sec = dateComp.second;



WRITTEN BY
블로blow
iOS 개발자 생활이야기

트랙백  0 , 댓글  0개가 달렸습니다.
secret