I am a junior iOS developer. and now I have problem when converting string to date object.
I don't know why the result (date object) always 7 hour behind the actual string I input. currently I am in Indonesia (GMT + 7), I don't know, but maybe it is related to the place where I live. here is the code I use
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
dateFormatter.locale = Locale(identifier: "en_US_POSIX")
dateFormatter.timeZone = Calendar.current.timeZone
let x = dateFormatter.date(from: "2018-07-18 12:00:00")
print(x)
result: 2018-07-18 05:00:00 +0000
how to fix this? really need your help