Skip to content

Instantly share code, notes, and snippets.

@gonzalezreal
Created October 24, 2012 07:19
Show Gist options
  • Select an option

  • Save gonzalezreal/3944528 to your computer and use it in GitHub Desktop.

Select an option

Save gonzalezreal/3944528 to your computer and use it in GitHub Desktop.
+ (NSDate *)dateFromTwitterDate:(NSString *)dateString
{
static dispatch_once_t onceToken;
static NSDateFormatter *dateFormatter;
dispatch_once(&onceToken, ^{
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];
[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
[dateFormatter setDateFormat:@"eee MMM dd HH:mm:ss ZZZZ yyyy"];
});
return [dateFormatter dateFromString:dateString];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment