iOS: Is it possible to get Timezone object from `India Standard Time` string?

167 views Asked by At

I know we can get the TimeZone object from the secondsFromGMT or the IANA identifier or from the abbreviation (like IST).

The thing is from the API, I get the string Pacific Standard Time. Which, none of the TimeZone initializers accept.

Is there any way I could instantiate the Timezone with this (such) string?

1

There are 1 answers

2
workingdog support Ukraine On

you could try this approach (adjust according to your needs):

let tz = TimeZone(abbreviation: apiString == "Pacific Standard Time" ? "PST" : "GMT")