Created
December 11, 2012 01:07
-
-
Save joshdholtz/4254876 to your computer and use it in GitHub Desktop.
StupidDate
This file contains hidden or 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
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]]; | |
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"]; | |
NSDate *date = nil; | |
NSError *error = nil; | |
if (![dateFormatter getObjectValue:&date forString:self range:nil error:&error]) { | |
NSLog(@"Date '%@' could not be parsed: %@", self, error); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment