• 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: NSDateFormatter giving different results in different programs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDateFormatter giving different results in different programs


  • Subject: Re: NSDateFormatter giving different results in different programs
  • From: Nick Zitzmann <email@hidden>
  • Date: Mon, 14 Apr 2008 11:09:44 -0600


On Apr 13, 2008, at 11:21 PM, Derrick Bass wrote:

In one program that links to this framework, the date is getting parsed correctly. But in another, the very same string is coming back as "1969-12-31 16:00:00 -0800"! Using - [getObjectValue:forString:range:error:] gives the same results.... no error.

What could be causing the different behaviors and how do I get the string to parse no matter what?


There are two styles of NSDateFormatter: The pre-Tiger style (10.0) and the Tiger & later style (10.4). The latter supports non-Gregorian calendars and automatically fetching properly localized date formatters, but when parsing strings into dates, they require the format to be extremely strict or they don't work. The former only supports the Gregorian calendar, and the methods of getting properly localized date formats have been deprecated, but they are much more flexible in the kind of input they take.

So make sure both formatters are of the 10.0 style.

Nick Zitzmann
<http://www.chronosnet.com/>




_______________________________________________

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: NSDateFormatter giving different results in different programs
      • From: Derrick Bass <email@hidden>
References: 
 >NSDateFormatter giving different results in different programs (From: Derrick Bass <email@hidden>)

  • Prev by Date: Re: "hooking" into another app
  • Next by Date: Re: "hooking" into another app
  • Previous by thread: NSDateFormatter giving different results in different programs
  • Next by thread: Re: NSDateFormatter giving different results in different programs
  • Index(es):
    • Date
    • Thread