I receive a date through a string parameter, which is tempDateString, in a [day month year] format (for ex. 01 05 2005):
NSLog(@"tempdatestring %@", tempDateString);
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd MM YYYY"];
NSDate *dayDate = [dateFormatter dateFromString:tempDateString];
NSLog(@"daydate %@", dayDate);
My problem is, that the two logs don’t match. The outputs are:
tempdatestring 04 10 2012
daydate 2011-12-24 22:00:00 +0000
What should I change at the date formatter’s date format, to get the good date?
2 Problems
@"dd MM yyyy"case sensitiveUse timezone to get the correct value[GMT value]