I'm using DateFormatter from Swift to show date to users in "yyyy.MM.dd" format. I find one thing very strange that even after I've set the Timezone, it gives me the date a day after.
let formatter = DateFormatter()
formatter.dateFormat = "yyyy.MM.dd"
formatter.locale = Locale(identifier: "ko_kr")
formatter.timeZone = TimeZone(abbreviation: "KST")
let date = formatter.string(from: myDate)
myDate above is like 2023-06-29 18:25:13 +0000 For example, today is 2023.06.29 and it should return 2023.06.29 but it returns 2023.06.30.
Is there any other parts that I should look into?
2023-06-29 18:25:13 +0000is indeed 2023-06-30 in Korea. Try adding 9 hours (Korea's offset) to 18:25:13. It'd go into the next day.