在 iOS 中,是否可以将小时、分钟、秒保存到当前时间的不同整数变量中?
谢谢!
是的你可以:
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [calendar components:(NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:[NSDate date]];
NSInteger hour = [components hour];
NSInteger minutes = [components minute];
NSInteger seconds = [components second];
这是一种表示:
CFGregorianDate date =
CFAbsoluteTimeGetGregorianDate(CFAbsoluteTimeGetCurrent(), tz);
(你打算如何拯救那个otoh……)