NSLog showing the previous Date

邮差的信 提交于 2019-12-01 23:22:42

If you log an NSDate object directly it will always display the tome in GMT/UTC timezone. you have to log the output of a date formatter.

NSLog(@"%@",[self.dateFormatter stringFromDate:toDate]);

This will take your timezone in account. Or better: the timezone of the dateformatter's calendar — what is the device default if you dont change that.

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