Oh, "j" works on iOS if you pass it to -dateFormatFromTemplate:options:locale:, 
but only if you pass [NSLocale currentLocale] and not nil.

On Mac OS X, the 12/24-hour format in the Clock is different than in the 
International settings. Changing the clock has no effect, but I haven't 
verified that changing the time format does.

-- 
Rick

On Feb 23, 2012, at 11:37 , Dave DeLong wrote:

> 
> On Feb 23, 2012, at 8:21 AM, Kyle Sluder wrote:
> 
>> On Feb 22, 2012, at 10:50 PM, Rick Mann <rm...@latencyzero.com> wrote:
>> 
>>> I have a need to format times as either
>>> 
>>>  24:mm
>>> 
>>> or
>>> 
>>>  12:mm
>>>    am
>>> 
>>> That is, if the user prefers a 24-hour clock, I want it to appear on a 
>>> single line. If the user prefers a 12-hour clock, I want the  AM/PM 
>>> designator to be rendered underneath the time (in smaller type).
>>> 
>>> Unfortunately, there's no format specifier for the hours of the day that 
>>> indicates "use the user's preferred format."
>> 
>> What happens if you give +[NSDateFormatter 
>> dateFormatFromTemplate:options:locale:] a template that contains "h:m:s a"? 
>> Does it rewrite it to "H:m:s" if the current locale uses 24-hour time?
> 
> If you're going to go with this route, you'd need to use "j:m:s".  According 
> to The Spec (http://unicode.org/reports/tr35/#Date_Format_Patterns), "use of 
> 'j' in a skeleton passed to an API is the only way to have a skeleton request 
> a locale's preferred time cycle type (12-hour or 24-hour)."
> 
> Cheers,
> 
> Dave


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to