Reputation: 1367
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:date];
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.
Upvotes: 0
Views: 609
Reputation: 27900
Referring to the documentation for +dateWithTimeIntervalSince1970:
, you will see that it takes an NSTimeInterval, which is simply a double.
Upvotes: 1