Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Created August 16, 2011 08:33
Show Gist options
  • Save fjolnir/1148665 to your computer and use it in GitHub Desktop.
Save fjolnir/1148665 to your computer and use it in GitHub Desktop.
- (void)setPubDate:(NSString *)dateAsString {
if(dateAsString == pubdate)
return;
[pubdate release];
pubdate = [dateAsString copy];
static NSDateFormatter *df = nil;
if(!df) {
df = [[NSDateFormatter alloc] init];
df.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease];
df.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
}
df.dateFormat = [self get_date_format];
date_pubdate = [[df dateFromString:pubdate] retain];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment