• 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: Simple date format problem? iOS 5
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple date format problem? iOS 5


  • Subject: Re: Simple date format problem? iOS 5
  • From: Alex Kac <email@hidden>
  • Date: Thu, 09 Aug 2012 20:39:22 -0500

That's what I thought. We'll try it with the locale and calendar identifier set. Yes, we could get a CFGregorian and just format it with stringForFormat...but this seems nice and simple too.

On Aug 9, 2012, at 8:35 PM, Jens Alfke <email@hidden> wrote:

>
> On Aug 9, 2012, at 6:26 PM, Dave DeLong <email@hidden> wrote:
>
>> I'm going to venture out on a limb and say you shouldn't be using NSDateFormatter for this.  NSDateFormatter is really only useful when you're converting a date to-and-from a human-readable form.  The way you're using it, it's not human-readable, and will cause you problems in very subtle ways.
>
> I think that's going too far — you can use NSDateFormatter for this, as long as you reset the calendar and locale:
>
>         formatter.calendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
>         formatter.locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease];
>
> (I'm not sure whether [NSLocale systemLocale] would work as well; I'm copying this from some working code of mine that generates ISO-8601 date strings.)
>
> —Jens

Alex Kac - President and Founder
Web Information Solutions, Inc.
"To educate a person in mind and not in morals is to educate a menace to society."
-- Theodore Roosevelt






_______________________________________________

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: 
 >Simple date format problem? iOS 5 (From: Alex Kac <email@hidden>)
 >Re: Simple date format problem? iOS 5 (From: Dave DeLong <email@hidden>)
 >Re: Simple date format problem? iOS 5 (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Simple date format problem? iOS 5
  • Next by Date: Re: How to...
  • Previous by thread: Re: Simple date format problem? iOS 5
  • Next by thread: Re: Simple date format problem? iOS 5
  • Index(es):
    • Date
    • Thread