NSTimeInterval time =(NSTimeInterval )[model.day floatValue];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:time];
//转化为字符串
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"yyyy/MM/dd hh:mm"];
NSString *dateStr = [dateFormatter stringFromDate:date];
本文介绍如何使用Objective-C将浮点数表示的天数转换为日期格式,并进一步转化为字符串形式。通过NSTimeInterval和NSDateFormatter实现从1970年至今的时间转换。
255

被折叠的 条评论
为什么被折叠?



