Oleg Gordiichuk Oleg Gordiichuk - 1 year ago 97
Swift Question

How to return "UTC+XX:XX" or "UTC-XX:XX" format from NSDate

I would like to know if there is standard method that could return current timezone of the devise in format "UTC+XX:XX" or "UTC-XX:XX"?

Based on formatting

i know that it is possible to get current time zone with help of "ZZZZ", that gives "GMT-08:00".

The question is if there is special formatting for
that will give "UTC-08:00" ?

Rob Rob
Answer Source

You could use yyyy-MM-dd'T'HH:mm:ss'UTC'ZZZZZ, i.e. a literal string UTC followed by ZZZZZ (-08:00).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download