I'm in PDT (pacific daylight time) which is -0700 hrs behind UTC. I'm using NSDateFormatter
to parse a time string, 4:00 PM, and then create a date:
NSDateFormatter *df = [[NSDateFormatter alloc] init];
NSDate *aDate = [[NSDate alloc] init];
[df setDateFormat:@"h:mm a"];
aDate = [df dateFromString:@"4:00 PM"];
aDate
returns as: 1970-01-02 00:00:00 +0000. However, I'd expect it to return: 1970-01-01 23:00:00 +0000 since 4PM should be 23:00 UTC.
Checking the date formatter time zone returns the correct (PDT) time zone, ie: America/xxx (PDT) offset -25200 (Daylight)
Does anybody know what is going on here? Thanks in advance for the help...