How to Convert a milliseconds to nsdate in objective C [duplicate]

不想你离开。 提交于 2019-12-13 10:10:05

问题


In instagram API,I got the below response

"created_time" = 1379598284;

I want to convert the created_time to NSDate

please help me


回答1:


use this

NSDate *date = [NSDate dateWithTimeIntervalSince1970:(ms / 1000.0)];



回答2:


simple try this...

  NSDate* date = [NSDate dateWithTimeIntervalSince1970:yourtime];

Happy Coding




回答3:


try this... as per follow to decode to date

NSDate *tr = [NSDate dateWithTimeIntervalSince1970:1379598284];

or

NSDate *tr = [NSDate dateWithTimeIntervalSinceReferenceDate:1379598284];

OR

NSDate *tr = [NSDate dateWithTimeIntervalSinceNow:1379598284];



回答4:


This is "2013-09-19 13:44:44 +0000" Try following line of code.

NSDate *date = [NSDate dateWithTimeIntervalSince1970:1379598284];


来源:https://stackoverflow.com/questions/18913601/how-to-convert-a-milliseconds-to-nsdate-in-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!