Oleg Gordiichuk Oleg Gordiichuk - 8 months ago 32
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

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