Skip to content

Instantly share code, notes, and snippets.

@AlexHedley
Created October 1, 2014 14:00
Show Gist options
  • Save AlexHedley/1f916f41ef31e334f5b7 to your computer and use it in GitHub Desktop.
Save AlexHedley/1f916f41ef31e334f5b7 to your computer and use it in GitHub Desktop.
Parse Date
//Parsing a date in the following format '//2014-07-13T20:35:47.000Z'
//Use the DateFormat of @"yyyy-MM-dd'T'HH:mm:ss.zzz'Z'"
- (NSString *)formattedDate {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.zzz'Z'"]; //2014-07-13T20:35:47.000Z
NSDate *tempDate = [dateFormatter dateFromString:self.date];
[dateFormatter setDateFormat:@"EE MMM, dd"];
return [dateFormatter stringFromDate:tempDate];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment