• 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: Formatting elapsed time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Formatting elapsed time


  • Subject: Re: Formatting elapsed time
  • From: Dave DeLong <email@hidden>
  • Date: Fri, 07 Sep 2012 18:01:37 -0700

This isn't quite correct.  "j:mm" is a template, not an actual format string.  When you run it through every possible locale, you get this output:

http://pastie.org/4683032

The presence of the colon in the template is incidental.  It would work just fine if you used "jmm" as well.

With the resulting date format string, you can strip out the "a" format character (which is what becomes the AM/PM designator), and then give that format string to -[NSDateFormatter setDateFormat:].

Dave

On Sep 7, 2012, at 5:37 PM, "Gary L. Wade" <email@hidden> wrote:

> If you want this localized, you don't want to assume the use of colons, the presence of an "a" or even the physical placement within the string for "am"—it could be at the start. Look at NSLocale and some of the lower-level frameworks like those in CoreFoundation and ICU to get something you'll be happy with in Russian, Chinese, Taelon, and Klingon as well as English.
_______________________________________________

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


References: 
 >Formatting elapsed time (From: Dennis <email@hidden>)
 >Re: Formatting elapsed time (From: Jens Alfke <email@hidden>)
 >Re: Formatting elapsed time (From: Dennis <email@hidden>)
 >Re: Formatting elapsed time (From: Jens Alfke <email@hidden>)
 >Re: Formatting elapsed time (From: Dave DeLong <email@hidden>)
 >Re: Formatting elapsed time (From: "Gary L. Wade" <email@hidden>)

  • Prev by Date: Re: Advice for rotating content in a window so it doesn't get clipped
  • Next by Date: Re: Malloc Error: pointer being freed was not allocated
  • Previous by thread: Re: Formatting elapsed time
  • Next by thread: Re: Formatting elapsed time
  • Index(es):
    • Date
    • Thread