+2  A: 

Probably has something to do with time zones. You probably need to set an appropriate value for the timeZone property of your NSDateFormatter object.

William Jockusch
Hmm, so I set the time zone property to be the localTimeZone. But the result is still the same. It works when the time is more than 7am. But anything before that, causes the date to go back by a day.
Mansi
This was the fix: [dateFormat setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]];
Mansi