I'm in England during daylight savings time (known locally as BST "British Summer Time"). I want my app to display the time with a suffix identifying the BST timezone (e.g. 12:45 BST). The code below should do this but displays the GMT offset instead:
let formatter = DateFormatter()
formatter.dateFormat = "HH:mm z"
formatter.timeZone = TimeZone(identifier: "Europe/London")
print(formatter.string(from: Date()))
This displays: 12:45 GMT+1
The reason for this is presumably because "the system" thinks that GMT+1
is the correct abbreviation. For example:
dump(TimeZone(identifier: "Europe/London"))
prints the following:
▿ Optional(Europe/London (current))
▿ some: Europe/London (current)
- identifier: "Europe/London"
- kind: "current"
▿ abbreviation: Optional("GMT+1")
- some: "GMT+1"
- secondsFromGMT: 3600
- isDaylightSavingTime: true
Question: Is there a form of timezone identifier that correctly yields "BST
" as the correct abbreviation for British Summer Time?