I'm letting the user input a date into a UITextField. When I format the string and output it in a NSLog statement, I am getting an incorrect value for the date. For instance, when I input 11-16-2011 11:43 into the text field, I get 2010-12-26 16:43:00 +0000 in the log. My code is as follows:
NSString *dateString = dateTextField.text;
//create a NSDateFormatter that can be used to create a NSDate from the string
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MM-dd-YYYY hh:mm"];
[formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:-18000]];
//create a NSDate from the string using our formatter
NSDate *alertTime = [formatter dateFromString:dateString];
NSLog(@"dateString is %@", alertTime);
[formatter release];
Thanks!