I'm trying to convert a string to an NSDate using the following code:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeZone:[NSTimeZone localTimeZone]];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss"];
NSDate *date= [dateFormatter dateFromString:@"2013-03-10T02:00:00"];
It works fine for all hours except 02:00:00, shown above, which returns nil.
Any ideas?
This is because of the Daylight Savings Time that took place in the US on 10th March 2013
The System time directly jumps from 1:59 AM to 3:00 AM..
You lose an hour that you had gained on November when the DST came into effect
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With