• 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: Derrick Bass <email@hidden>
  • Date: Mon, 14 Apr 2008 23:04:09 -0700

Well, setting the NSDateFormatter to 10.0 style fixed it. Why it is that one program is using 10.4 style and the other 10.0 style by default is still something of a mystery to me, but it's fixed! Thanks!

Derrick

On Apr 14, 2008, at 10:09 AM, Nick Zitzmann wrote:


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


References: 
 >NSDateFormatter giving different results in different programs (From: Derrick Bass <email@hidden>)
 >Re: NSDateFormatter giving different results in different programs (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: NSAllocateCollectable() questions
  • Next by Date: Re: is this badly written code?
  • Previous by thread: Re: NSDateFormatter giving different results in different programs
  • Next by thread: Plugin Information
  • Index(es):
    • Date
    • Thread