I am importing a CSV file with the format of the month / day / year date (e.g. 21/01/2007).
I go through CSV, some work, but some come out with a date 1 day ago with a time of 23:00? One of the dates that do not work will look like this:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"M/d/yyyy"];
NSDate *date = [dateFormatter dateFromString:@"10/7/2007"];
but when I output the date in NSLog, it has the following:
NSLog(@"Date: String: %@ Date: %@", @"10/7/2007", date);
Date: String: 10/7/2007 Date: 2007-10-06 23:00:00 GMT
What am I doing wrong?
source
share