开发者

unix timestamp format converter in iphone

im using json in my new app. im getting time in UNIX timestamps format. i try to get this done by this code..

NSDate *date = [NSDate dateWithTimeIntervalSince1970:1234567];
NSDateComponents *weekdayComponents = [[NSCalendar currentCalendar] components:NSWeekdayCalendarUnit fromDate:d开发者_开发知识库ate];
int weekday = [weekdayComponents weekday];

this work correctly if i try to passed time hardcoaded but didn't work on dynamically. means i didnot get in which format(decimalnumber, double) should i passed a variable in place of 1234567?

please help me regarding this.


Referring to the documentation for +dateWithTimeIntervalSince1970:, you will see that it takes an NSTimeInterval, which is simply a double.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜