Romula Romula - 1 month ago 14
iOS Question

UIDatePicker change locale

I am trying to change locale for UIDatePicker like this:

picker.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];


It is working, but after setting locale the picker does not meet the system settings of time format. I mean 24hr/(AM/PM). What I am doing wrong?

Answer

You are not doing anything wrong. Date/time format is dictated by locale. And en_US uses 12hr AM/PM format: http://demo.icu-project.org/icu-bin/locexp?_=en_US