hello, i'm getting odd results when nslog nsdate created nsdatecomponents: code:
nsdate *test; nsdatecomponents *comps = [[nsdatecomponents alloc] init]; [comps setday:26]; [comps setmonth:3]; [comps setyear:2012]; test = [[nscalendar currentcalendar] datefromcomponents:comps]; nslog(@"day: %i, month: %i, year: %i, date: %@", [test day], [test month], [test year], test); // outputs: day: 26, month: 3, year: 2012, date: 2012-03-25 23:00:00 +0000 when nslog nsdate code produces, outputs 2012-03-25, not 2012-03-26. however, if set components date prior 2012-03-26, such 2012-03-25, works - outputting 2012-03-25 00:00:00. date after , including 26th march 2012 logs date previous day hour portion set 23:00:00. can't life of me understand why? appreciated! cheers -ross
hello,
i'm getting odd results when nslog nsdate created nsdatecomponents:
code:
nsdate *test; nsdatecomponents *comps = [[nsdatecomponents alloc] init]; [comps setday:26]; [comps setmonth:3]; [comps setyear:2012]; test = [[nscalendar currentcalendar] datefromcomponents:comps]; nslog(@"day: %i, month: %i, year: %i, date: %@", [test day], [test month], [test year], test); // outputs: day: 26, month: 3, year: 2012, date: 2012-03-25 23:00:00 +0000 when nslog nsdate code produces, outputs 2012-03-25, not 2012-03-26. however, if set components date prior 2012-03-26, such 2012-03-25, works - outputting 2012-03-25 00:00:00. date after , including 26th march 2012 logs date previous day hour portion set 23:00:00. can't life of me understand why?
appreciated!
cheers
-ross
click expand...
sounds daylight savings in uk
Forums iPhone, iPad, and iPod Touch iOS Programming
iPhone Mac OS & System Software iPad Apple Watch Notebooks iTunes Apple ID iCloud Desktop Computers Apple Music Professional Applications iPod iWork Apple TV iLife Wireless
No comments:
Post a Comment