I have this piece of code:
NSDateFormatter* df = [[NSDateFormatter alloc] init];
df.locale = [NSLocale currentLocale];
df.timeZone = [NSTimeZone localTimeZone];
df.timeStyle = NSDateFormatterShortStyle;
df.dateStyle = NSDateFormatterShortStyle;
df.locale = [NSLocale currentLocale];
[df setDateFormat:@"dd/MM/yyyy"];
NSString *todaysDate = @"31/12/2013";
NSDate* today = [df dateFromString:todaysDate];
NSLog(@"comparing todaysDate: %@ with today: %@",todaysDate,today);
When I check my console I see that todaysDate is 31/12/2013 and today is 2013-12-30 21:00:00 +0000 I do not understand why it goes 1 day into the past... can anyone help me out here? I'm trying to basically filter out some items in a dictionary based on date. Filtering part not included here as it was determined that the dateFromString is not doing its job.