Created
September 20, 2012 14:57
-
-
Save simonpang/3756413 to your computer and use it in GitHub Desktop.
parsing RFC3339 date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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