I'm having issues setting a NSDate when the Date Format in the phone is set to 12h(am, pm) instead of 24h.
Here's the code.
[df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *dateStart = [df dateFromString:@"2013-10-11 18:00:00"]];
NSLog(@"Date: %@", dateStart);
This code either prints "2013-10-11 18:00:00" when the device's time is set to 24h, like NSDateFormatter or null if the settings of the phone is set to 12hrs. You can change the settings by going to Settings->General->Date and Time-> there you set the checkbox to a 12 hour time format.
Why is this even happening? Why is the phone settings affecting the app's behaviour?
Thanks.