以下是将秒转换为天、小时、分钟的Objective-C代码示例:

- (void)convertSeconds:(int)seconds {
    int days = seconds / (60 * 60 * 24);
    int hours = (seconds % (60 * 60 * 24)) / (60 * 60);
    int minutes = (seconds % (60 * 60)) / 60;

    NSLog(@"%d天 %d小时 %d分钟", days, hours, minutes);
}

你可以调用这个方法并传入以秒为单位的时间来获取相应的天、小时和分钟值。例如:

[self convertSeconds:86400];

这将输出:1天 0小时 0分钟。

iOS 秒转天小时分钟 oc代码

原文地址: https://www.cveoy.top/t/topic/i7GQ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录