Romula Romula - 1 year ago 116
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 Source

You are not doing anything wrong. Date/time format is dictated by locale. And en_US uses 12hr AM/PM format:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download