Change UIDatePicker from 12 hour clock to 24 hour clock and back?

This is not the answer you are looking for, but in Cocoa you could create an NSDateFormatter and attach it to an NSDatePicker (which is an NSControl) using setFormatter. Unfortunately the equivalent iPhone class (UIControl) does not support this yet. I raised a bug with Apple about it and this is a known issue, although they wouldn't tell me if/when they plan to fix/enhance it.

Up vote 2 down vote favorite 1 share g+ share fb share tw.

I'm sorry to make my first question here a bit of a simple one -- I've spent a day reading the NSLocale and NSCalendar class descriptions but I couldn't see if this was possible. I have a UIDatePicker in the UIDatePickerModeDateAndTime mode. It is currently displaying date and time according to the user's locale, which is the default behavior.

I would like to be able to offer the option to show the UIDatePicker in either 12-hour or 24-hour time format. Detecting which time format the user is currently using isn't a problem, but I'm not clear on how to change just the time format of UIDatePicker without entirely throwing out the user's locale settings (since the picker also displays the localized days of the week and months). UIDatePicker supports setting its locale and setting its calendar.

So, question one is whether this is something I should be trying to do via NSLocale or NSCalendar, and question two is if anyone can recommend a way to isolate the time format without throwing out the rest of the user's locale settings. Thanks for any suggestions. Objective-c iphone cocoa-touch uidatepicker link|improve this question asked Jun 9 '09 at 10:41Halle8491520 100% accept rate.

1 For what it's worth, what you're describing doesn't work in Cocoa (in Mac OS X) either. Adding a date formatter to NSDatePicker using setFormatter: doesn't have any affect. The closest you can get it to set the locale (using setLocale:) to a locale that uses 24 hour time (like Japan).

– Andrew Madsen Dec 23 '10 at 20:32.

OK, after reading the last two years' worth of others asking the same question here, it seems that there is no way to do this since the UIDatePicker uses the user's country setting instead of the user's locale setting, and that can't be overridden programmatically. I filed a bug.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions