iphone - NSDate not returning correct date -
i printing nsdate this:
nsdate *date = [nsdate date]; nsstring *stringdate = [data description]; right now, it's july 1, 2011 11:43 pm. ipod says on top bar. stringdate prints out: 2011-07-02 03:43:46 +0000
this wrong. have used nsdate millions of times never had problem. wrong? thanks
your region's time offset -04:00? nsdate automatically adjust time offset when displaying date. try,
nsstring *str = [date descriptionwithlocale:[nslocale currentlocale]]; it show correct date.
Comments
Post a Comment