Skip to content

Instantly share code, notes, and snippets.

@simonpang
Created September 20, 2012 14:57
Show Gist options
  • Save simonpang/3756413 to your computer and use it in GitHub Desktop.
Save simonpang/3756413 to your computer and use it in GitHub Desktop.
parsing RFC3339 date
- (NSDate *)parseDate:(NSString *)object {
if ([object isKindOfClass:[NSString class]]) {
// See workaround for parsing RFC3339 dates:
// http://stackoverflow.com/questions/4330137/parsing-rfc3339-dates-with-nsdateformatter-in-ios-4-x-and-macos-x-10-6-impossib
NSError *error = nil;
NSDate *date = nil;
[[self dateFormatter] getObjectValue:&date forString:object range:nil error:&error];
return date;
}
return nil;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment