UIDatePicker returns wrong date (-1 day to the real date)

Check if you use the wrong formatting symbols with big letters: "YYYY". Replace them with "yyyy".


It is deffinately something with the timezones and/or Daylight Saving Times. But it must be very subtle, as the code looks fine (beside the interval). Now to my question about if you are in russia:

This year the Kremlin did several back and forth swings on keeping daylight saving times forever. Actually I am not sure, what they decided at last. But maybe it isnt reflected correctly in Cocoa. The the video WWDC 2011 Video "Session 117 - Performing Calendar Calculations" , the presenter even mentions that things like that can happen.

Please try to work with dates with manually set times to noon, as this would keep you out of such mess.


The world just saw a similar misbehavior in iOS 6: the DND-Always-Active bug. I bet this was for a wrong date format (YYYY instead of yyyy)


Also try to set the timezone property on the picker at the very first thing and assign a manually instantiated Gregorian calendar to it.


Just add one line of code for setting your timezone.

self.datePicker.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];

0 is for GMT 00 . Add according to your time zone.


My solution was to set the returned date to 12:00 AM as NSDates work in UTC

NSDate * adjustedDate = [[NSCalendar currentCalendar] dateBySettingHour:12 minute:0 second:0 ofDate:sender.date options:0];

Also for date calculations you shoud use NSCalender methods and not addTimeInterval