How do I convert "4:15:00 PM" to an NSDate? Below is the code I have:
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"HH:mm:ss aa"];
NSDate *date = [df dateFromString:@"4:15:00 PM"];
NSLog(@"date: %@",date);//outputs: 1970-01-01 17:15:00 +0000
//should output: 1970-01-01 16:15:00 +0000
UPDATE: I updated based on responses and I am still having the incorrect show:
NSLog(@"date: %@",[df stringFromDate:date]);//outputs: 12:15:00 PM
//should output: 4:15:00 PM
The question is why does the time change from 4:15:00 PM 12:15:00 PM.