Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift change date picker language

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.

like image 759
Evgeniy Kleban Avatar asked Nov 01 '17 13:11

Evgeniy Kleban


Video Answer


1 Answers

You should assign loc to the date picker locale property:

let loc = Locale(identifier: "uk")
self.datePicker.locale = loc
like image 102
Ahmad F Avatar answered Oct 04 '22 03:10

Ahmad F