Swift change date picker language
13,279
You should assign loc
to the date picker locale property:
let loc = Locale(identifier: "uk")
self.datePicker.locale = loc
![Evgeniy Kleban](https://i.stack.imgur.com/JCS3K.jpg?s=256&g=1)
Author by
Evgeniy Kleban
Updated on July 22, 2022Comments
-
Evgeniy Kleban almost 2 years
I want to change format of month represent in my UIDatePicker. I tried:
self.datePicker = UIDatePicker() self.datePicker.backgroundColor = .white self.datePicker.datePickerMode = .date let loc = Locale.init(identifier: "uk") var calendar = Calendar.current calendar.locale = loc self.datePicker.calendar = calendar
After that, month representation suppose to be in ukranian, but it still in other language.
-
えるまる over 4 yearsThanks for your answer, do you know way to change global locale so that each formatter would use it?
-
Ahmad F over 4 years