0
NSDate *now = [NSDate date];
NSCalendar *calendar = [NSCalendar currentCalendar];
// find next date where the minutes are zero
NSDate *nextHour = [calendar nextDateAfterDate:now matchingUnit:NSCalendarUnitMinute value:0 options:NSCalendarMatchNextTime];
// get the number of seconds between now and next hour
NSDateComponents *componentsToNextHour = [calendar components:NSCalendarUnitSecond fromDate:now toDate:nextHour options:0];
//NSLog(@"%ld", componentsToNextHour.second);
NSString *dec = [NSString stringWithFormat:@"%ld", (long)componentsToNextHour.second];
위의 코드에서 현재 날짜와 시간을 초로 변환하지만이 초를 unixtimestamp로 변환 할 수 없으므로이 방법에 대한 아이디어는 높이 평가 될 것입니다.객관적인 C에서 초를 UnixTimeStamp로 변환하는 방법?
이 우수한, 그래서 내가 먼저 초에 변환 환상적인, 매우 감사, 당신은 시간의 내을 절약 할 필요가없는, 내가했다 그것에 시간을 찔렀다. –