How would I convert an NSMutableArray filled of UNIX dates to standard dates?
I have an NSMutableArray filled up of UNIX dates (1305410327), and I want to convert all of them to readable dates like Fri, 06 Feb 2009 07:28:06 +0000. I'm so lost and this is the code I have:
NSDate *fulltime = [NSDate dateWithTimeIntervalSince1970:[time obje开发者_JAVA技巧ctAtIndex:indexPath.row]];
But gives me next error when compiling:
error: incompatible type for argument 1 of 'dateWithTimeIntervalSince1970:'
So I don't know how to make it work. Thanks all in advance! :)
zad0xsis,
You need to convert the NSNumber into an NSTimeInterval. Here is a fix to your code:
NSDate *fulltime = [NSDate dateWithTimeIntervalSince1970:
[[time objectAtIndex:indexPath.row] doubleValue]];
Andrew
精彩评论