Background
I need to convert time string with format: "HH:mm" from UTC to local timezone. For example if UTC time is 09:00, local time (Stockholm/Europe) should be two hours ahead.
Problem
When I convert 09:00 (UTC) to Stockholm/Europe time I get 10:00. It should be 11:00.
func UTCToLocal(date:String) -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "HH:mm"
dateFormatter.timeZone = TimeZone(abbreviation: "UTC")
let dt = dateFormatter.date(from: date)
dateFormatter.timeZone = TimeZone.current //Stockholm/Europe
return dateFormatter.string(from: dt!)
}
print(UTCToLocal(date: "09:00")) //prints 10:00
Why is the timezone different from what it suppose to be?