//轉換成時分秒
- (NSString *)timeFormatted:(int)totalSeconds
{
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int hours = totalSeconds / 3600;
return [NSString stringWithFormat:@"%02d:%02d:%02d",hours, minutes, seconds];
}
//轉換成當前時刻
- (NSString *)timeFormatted:(int)totalSeconds
{
NSDate??*date = [NSDate dateWithTimeIntervalSince1970:totalSeconds];
NSTimeZone *zone = [NSTimeZone systemTimeZone];
NSInteger interval = [zone secondsFromGMTForDate: date];
NSDate *localeDate = [date??dateByAddingTimeInterval: interval];
NSLog(@"enddate=%@",localeDate);
}