user2384583 user2384583 - 3 months ago 28x
Objective-C Question

Is there anyway to hide the 24hrs format in UIDatePicker

I am doing the application with

for time format. It is working in 12hrs format, if i change the iPhone date/time to 24hrs format, I need to display only 12hrs format, not the 24hrs format.

Is there anyway to disable the 24hrs format?


Use this code for 12 hour format

NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"US"];
[self.datePicker setLocale:locale];

Use this code for 24 hour format

NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"NL"];
[self.datePicker setLocale:locale];