elp*_*elp 2 iphone objective-c nsdate nsdateformatter ipad
可能重复:
在Obj-c中将秒转换为天,分和小时
如何在Objective-C中完成
例如:
349200秒??
Nis*_*t B 10
添加以下函数并在此函数中传递"秒"值.
- (void)displayTimeWithSecond:(NSInteger)seconds
{
NSInteger remindMinute = seconds / 60;
NSInteger remindHours = remindMinute / 60;
NSInteger remindMinutes = seconds - (remindHours * 3600);
NSInteger remindMinuteNew = remindMinutes / 60;
NSInteger remindSecond = seconds - (remindMinuteNew * 60) - (remindHours * 3600);
NSLog(@"Hours = %@", [NSString stringWithFormat:@"%02d",remindHours]);
NSLog(@"Minute = %@", [NSString stringWithFormat:@"%02d",remindMinuteNew]);
NSLog(@"Seconds = %@", [NSString stringWithFormat:@"%02d",remindSecond]);
}
Run Code Online (Sandbox Code Playgroud)
这里,displayTime是Label.
| 归档时间: |
|
| 查看次数: |
1930 次 |
| 最近记录: |