I have the following code.
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MM/d/YYYY"];
NSDate *addedDate = [dateFormat dateFromString:weightDTO.dateAdded];
[dateFormat release];
NSLog(@"dateAdded %@", weightDTO.dateAdded);
NSLog(@"addedDate %@", addedDate);
This print the following in a loop with 2 entries.
dateAdded 06/2/2012
addedDate 2011-12-18 18:30:00 +0000
dateAdded 06/8/2012
addedDate 2011-12-18 18:30:00 +0000
So it is supposed to get a 2012 date for addedDate object. However the result is different. What am I doing wrong here?
Thank you
change your
dateFormatto this –