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に変換することはできません。これについての考え方は高く評価されます。秒をUnixTimeStampに変換する方法は?
は優秀なので、私は最初、秒に変換ファンタスティック、非常に認め、あなたは時間の私の多くを保存する必要がいけない、私はでしたそれに時間を詰め込んだ。 –