On Aug 9, 2012, at 6:26 PM, Dave DeLong <davedel...@me.com> 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
_______________________________________________

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