NSDate change time zone

后端 未结 1 1007
死守一世寂寞
死守一世寂寞 2021-01-19 15:59

I am writing an app that involves time zone. I want to grab the user\'s device time, lets call that dateA, and I have a target date that will always be in EDT t

1条回答
  •  清歌不尽
    2021-01-19 16:34

    A NSDate is stored in a timezone neutral way. It's up to the NSDateFormatter to actually format for a given timezone using -[NSDateFormatter setTimeZone:]. If you want a string from NSDate, there's also -[NSDate descriptionWithCalendarFormat:timeZone:locale:], but it's usually better to use a NSDateFormatter instead.

    0 讨论(0)
提交回复
热议问题