I have this Following date Formatter code
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-ddThh:mm:ss"];
NSDate *result = nil;
NSRange range = NSMakeRange(0, 10);
NSError *error = nil;
[df getObjectValue:&result forString:[msgColoums objectAtIndex:4] range:&range error:&error];
NSLog(@"Error in Parsing = %@", error);
INLog(@"Date From DF = %@", [df dateFromString:@"2011-12-14T16:31:26.0000000"]);
The code returns null for the dateFromString message.
The Error is NSInvalidValue=2011-12-14T16:31:26.0000000.
If I change the formatting string to
[df setDateFormat:@"yyyy-MM-dd"];
then it will work, so the problem is in the time part.
Will someone please shed some light on this?
Try:
to quote the literal
T