美文网首页关于iOS
把秒数转换为时分秒格式

把秒数转换为时分秒格式

作者: 安然slience | 来源:发表于2015-12-17 17:47 被阅读233次

+(NSString*)TimeformatFromSeconds:(NSInteger)seconds

{

//format of hour

NSString *str_hour = [NSString stringWithFormat:@"%02d",seconds/3600];

//format of minute

NSString *str_minute = [NSString stringWithFormat:@"%02d",(seconds%3600)/60];

//format of second

NSString *str_second = [NSString stringWithFormat:@"%02d",seconds%60];

//format of time

NSString *format_time = [NSString stringWithFormat:@"%@:%@:%@",str_hour,str_minute,str_second];

return format_time;

}

相关文章

网友评论

    本文标题:把秒数转换为时分秒格式

    本文链接:https://www.haomeiwen.com/subject/hsjphttx.html