iphone - Why NSCalendar's dateFromComponents returns wrong date? -
i expecting 2010-10-11 00:00:00
but instead receive 2010-10-10 21:00:00 +0000
i know, can add few hours , receive desired date, not understand why previous day 21 hours...
please, help!
nsdatecomponents *comps = [[nsdatecomponents alloc] init]; [comps setyear:2010]; [comps setmonth:10]; [comps setday:11]; [comps sethour:0]; [comps setminute:0]; [comps setsecond:0]; nscalendar *cal = [[nscalendar alloc] initwithcalendaridentifier:nsgregoriancalendar]; nsdate *retdate = [cal datefromcomponents:comps];
i think problem may solved setting nstimezone
.
Comments
Post a Comment