Skip to content

Instantly share code, notes, and snippets.

@aliharis
Created June 22, 2014 18:49
Show Gist options
  • Save aliharis/dc5dab8f280de421225d to your computer and use it in GitHub Desktop.
Save aliharis/dc5dab8f280de421225d to your computer and use it in GitHub Desktop.
Convert UNIX Timestamp to NSDate and to user's local timezone
NSDate *dateTraded = [NSDate dateWithTimeIntervalSince1970:1408636621];
NSDateFormatter *_formatter=[[NSDateFormatter alloc]init];
[_formatter setLocale:[NSLocale currentLocale]];
[_formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *_date=[_formatter stringFromDate:dateTraded];
NSLog(@"Final time: %@", _date);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment