• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDatePicker 24 hour clock
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDatePicker 24 hour clock


  • Subject: Re: NSDatePicker 24 hour clock
  • From: Daniel Wambold <email@hidden>
  • Date: Sat, 9 Jan 2010 08:09:53 -0500

> Daniel Wambold (email@hidden) on 2010-01-08 6:12 PM said:
>
>> Hello. I have an NSDatePicker (NSTextFieldAndStepperDatePickerStyle) and
>> I need it to display time in a 24-hour time mode. After reading Apple's
>> docs and searching the Web, I can't seem to find a way to make this
>> happen. I have attached an NSDateFormatter in IB and specified 24-hour
>> time (HH:MM), but the program reverts back to a 12-hour clock. I changed
>> my System Preferences to a 24 hour clock, but the NSDatePicker refuses
>> to change. I tried a programmatic formatter:
>>
>> NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
>> [dateFormatter setDateFormat:@"HH:mm"];
>> [myDatePicker setFormatter:dateFormatter];
>> (Also tried [[myDatePicker cell] setFormatter:dateFormatter];)
>>
>> In desperation, I set a loop trying every NSDatePickerElementFlags from
>> 0 to 513. Have I missed something, or is a 24-hour clock not allowed?
>> The program is for use in a location where 24-hour time is mandatory.
>> Thanks for any insight you might have.

> Strange.  Have you tried in a test app?  My app's
> NSTextFieldAndStepperDatePickerStyle NSDateField follows Sys Pref
> settings.  I did nothing fancy to get that behaviour.
>
> Sean

Sean-
Thanks for your reply. Yes, I tried a sample App. (XCode > New Project > Cocoa App. Open Xib in IB. Drag DatePicker into window. Build & debug. AM/PM. Change System Pref to 24 hour clock. Rebuild & debug. Same behavior).
However, I really prefer to specify this outside of the System Preferences anyway. Most of us (in the US) are used to AM/PM clocks (so I want the rest of the computer's apps to work in AM/PM), but for this work related project, the time must be military. In any event, I couldn't force a change of behavior in this code-free (at least by me....) sample app in 10.6.2
Thanks
-Dan_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSDatePicker 24 hour clock
      • From: "Sean McBride" <email@hidden>
  • Prev by Date: Re: NSDatePicker 24 hour clock
  • Next by Date: Re: A password strength checker
  • Previous by thread: Re: NSDatePicker 24 hour clock
  • Next by thread: Re: NSDatePicker 24 hour clock
  • Index(es):
    • Date
    • Thread