I\'m having a problem. I get incoming time strings in 12-hour format, and I\'m turning them into NSDate objects. When the iPhone is in 12 hour format, no problem. But when i
The reason for this behaviour is Locale, set the correct Locale
NSString *strAgendaDate = @"01/17/2012 12:00 AM";
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease];
[dateFormatter setDateFormat:AgendaDateFormatForMeeting];
NSDate *meetingDate = [dateFormatter dateFromString:aStrDate];
[dateFormatter setDateFormat:AgendaDateRepresentation];
strAgendaDate = [dateFormatter stringFromDate:meetingDate];
It works for both 24-hour and 12 hour format