• 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
10.4 NSDateFormatter format strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

10.4 NSDateFormatter format strings


  • Subject: 10.4 NSDateFormatter format strings
  • From: SA Dev <email@hidden>
  • Date: Mon, 12 Sep 2005 12:14:39 -0400

List:

I'm having difficulties adjusting to the new ICU string format referenced by the NSDateFormatter docs. I want to display a four- digit year and the era. I'm creating a formatter like this:

NSDateFormatter * df = [[[NSDateFormatter alloc] initWithDateFormat:@"yyyy G" allowNaturalLanguage:YES] autorelease];

  I'm then assigning the formatter to my NSTextField like this:

[dateField setFormatter:df];

My objects (whose dates are being displayed by the date field) have a default date value of today just for testing purposes, like [NSDate date]. The date field's value is bound to the current object's date property. (Note, without the bindings established, the date's description string is shown, so things are bound properly).

I'm creating and assigning the formatter programmatically so I can change the formatter's format string on the fly.

The problem is, when the app is run with the formatter in place, the date format string is displayed (ie, "yyyy G") rather than the formatted date itself.

  What have I done wrong?


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: 10.4 NSDateFormatter format strings
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Newbie: Advice needed on "XML App"
  • Next by Date: Re: Final attempt regarding core data / opengl...
  • Previous by thread: Re: Bug in NSImageView / NSPDFImageRep in Tiger?
  • Next by thread: Re: 10.4 NSDateFormatter format strings
  • Index(es):
    • Date
    • Thread