NSDate date method returns wrong result

前端 未结 3 852
日久生厌
日久生厌 2020-12-11 18:14

I know there is a lot of questions of this type, but I did\'t find solution for my case; I need to get current and correct NSDate object, not NSString

3条回答
  •  借酒劲吻你
    2020-12-11 18:46

    The date probably has the correct value; perhaps you think it's incorrect because it looks wrong when you log it? This is because when you log it, it shows the date in UTC. You can get the string in your local timezone by using an NSDateFormatter.

提交回复
热议问题