NSDateFormatter incorrect date on simulator, correct date on device

Posted by Rudiger on Stack Overflow See other posts from Stack Overflow or by Rudiger
Published on 2010-03-17T04:03:20Z Indexed on 2010/03/17 4:11 UTC
Read the original article Hit count: 436

Hi,

Im building a calendar and to find out the first day of the month I do

[formatter setDateFormat:@"e"];
int startDay = [[formatter stringFromDate:newDate] intValue];

On the device this works correctly and the 1st of the month is on the correct day. But on the simulator it is the day after. Although it doesn't overly matter about the simulator it is kind of driving me crazy thinking I've done something wrong. I tried to set the locale of the formatter but no difference, nor i think should it. Can anyone shed some light on this?

On a side note is there a better way to build a calendar than this?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c