首页 > 其他 > 详细

ios 把毫秒值转换成日期

时间:2014-01-25 13:32:56      阅读:334      评论:0      收藏:0      [点我收藏+]

ios 把毫秒值转换成日期 (比较好用)

1343359790000 这是毫秒值
------最佳解决方案--------------------
long long time=1343359790000LL;
NSDate *date = [[[NSDate alloc]initWithTimeIntervalSince1970:time/1000.0]autorelease];

------其他解决方案--------------------
接上,转成可见的年月日格式日期的话可以:
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
dateFormatter.dateFormat = @"yyyy-MM-dd";
return [dateFormatter stringFromDate:date];
------其他解决方案--------------------
还可以使用dateWithTimeIntervalSinceNow或者dateWithTimeIntervalSinceReferenceDate

ios 把毫秒值转换成日期

原文:http://www.cnblogs.com/someonelikeyou/p/3532802.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!