'What is timezone format and how to convert it to a normal abbreviation in Swift?

I am working on an iOS app and after networking, I get JSON back with a timezone property formatted as some kind of number. Here is a picture

enter image description here

What is that number for timezone and how do I convert it something I can use in my app like "GMT" for example?



Solution 1:[1]

32400 (seconds) is the equivalent of 9 hours.

You get a TimeZone instance with

TimeZone(secondsFromGMT: timezone)

which is GMT+0900

However you cannot get the identifier like JST just from the seconds because there are multiple identifiers for the same amount of seconds.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1