NSDate not returning correct date

大憨熊 提交于 2019-11-27 15:52:25

Your region's time offset is -04:00? NSDate will automatically adjust the time offset when displaying the date. Try,

NSString *str = [date descriptionWithLocale:[NSLocale currentLocale]];

It will show you the correct date.

Are you in the GMT -4 time zone? The result that it is giving you would be correct in that case, as 2011-07-02 03:43:46 +0000 is 2011-07-01 11:43:46 -4000.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!