开发者

How can I get current time in a +7 timezone on iPhone?

开发者 https://www.devze.com 2023-01-16 18:39 出处:网络
I want to get the +7 timezone 开发者_Go百科on iPhone, how can I do so? Thank you. If you want to output the date, create an NSDateFormatter instance and set its time zone to the one you want. Then use

I want to get the +7 timezone 开发者_Go百科on iPhone, how can I do so? Thank you.


If you want to output the date, create an NSDateFormatter instance and set its time zone to the one you want. Then use the date formatter to create the date string.

If you want to get the date components (day, hour, etc.) of a date in a given time zone, create an NSCalendar instance, set its time zone accordingly, and send a components:fromDate: message to the calendar object.

0

精彩评论

暂无评论...
验证码 换一张
取 消