I want to return a date/time coming from my API. Server is based in Amsterdam.
Swift:
//load from api
print(date)
let df = DateFormatter()
df.dateFormat = "yyyy-MM-dd HH:mm:ss"
df.timeZone = TimeZone(identifier: "Europe/Amsterdam")
df.locale = Locale(identifier: "en_US")
var updated = dateFormatter.date(from: "\(date)")
//return format
print(updated)
Return:
2020-01-10 00:01:01
Optional(2020-01-09 23:01:01 +0000)
I don't know why, but the output is returning GMT I think. To output should be 2020-01-10 00:01:01 +0000
because Amsterdam is GMT+1.