When I use this date formatter, it's not giving me back the same date I start with if I got from date -> string -> date.
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[formatter setDateFormat:@"MMM d, YYYY hh:mm aaa"];
NSDate *date = [NSDate date];
NSString *string = [formatter stringFromDate:date];
NSDate *resultingDate = [formatter dateFromString:string];
My test generated a date string of Aug 24, 2010 01:00 PM
. When fed back into dateFromString
I get 2009-12-27 13:00:00
. The time is correct, but the date is all wrong.
Anyone know what's going on here?