• 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: Back-to-front date formatting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Back-to-front date formatting


  • Subject: Re: Back-to-front date formatting
  • From: Jeremy Dronfield <email@hidden>
  • Date: Sat, 17 Jan 2004 11:53:32 +0000

On 16 Jan 2004, at 10:48 pm, Nicholas Riley wrote:

On Fri, Jan 16, 2004 at 10:16:53PM +0000, Jeremy Dronfield wrote:
The trouble is, -initWithString:calendarFormat: won't accept the year
at the beginning (it chokes and spits out a nil value). The same
happens if I try to extract the year with @"%Y". Does anyone know a way
around this?

Perhaps this is a bug in Mac OS X 10.2.x? Date/time formatting was quite
flaky in 10.2 and earlier, and was rewritten in 10.3, where your
example works fine:

NSCalendarDate alloc initWithString: '2004\nFriday 16 January' calendarFormat: '%Y\n%A %e %b'
2004
Friday 16 Jan

I tried it with several other dates and had no problems.

If you are using 10.3, make sure the string actually contains what you
think it does...

I am in fact using 10.3. Having played around some more, it seems that -initWithString:calendarFormat: will only work if the string is already formatted to match calendarFormat. If any elements are missing from the string, or are in a different order, the result is a nil string. Therefore, the only purpose of the method is to add textual features such as commas, carriage returns etc.
-Jeremy

========================================
email@hidden

theLocustFarm.net:
- fractious fiction at http://freespace.virgin.net/jeremy.dronfield
========================================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Back-to-front date formatting
      • From: Alexander Spohr <email@hidden>
    • Re: Back-to-front date formatting
      • From: Nicholas Riley <email@hidden>
References: 
 >Back-to-front date formatting (From: Jeremy Dronfield <email@hidden>)
 >Re: Back-to-front date formatting (From: Nicholas Riley <email@hidden>)

  • Prev by Date: Re: FileWrappers
  • Next by Date: Re: Back-to-front date formatting
  • Previous by thread: Re: Back-to-front date formatting
  • Next by thread: Re: Back-to-front date formatting
  • Index(es):
    • Date
    • Thread