In Swift Playground, I run this.
let string = "2019-01-14T00:00:00+08:00"
let utcTimezone = TimeZone(abbreviation: "UTC")!
let sgtTimezone = TimeZone(abbreviation: "SGT")!
let dfs = DateFormatter()
dfs.timeZone = sgtTimezone
dfs.locale = Locale(identifier: "en_sg")
dfs.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZ"
dfs.calendar = Calendar(identifier: Calendar.Identifier.iso8601)
let date = dfs.date(from: string)!
Why is date = Jan 13, 2019 at 11:00 PM and not the accurate Jan 14, 2019 at 00:00 AM ?
Tried changing the timezone to UTC but by default the result is UTC
I am expecting Jan 14, 2019 at 00:00 AM.. or at least Jan 14