Re: Back-to-front date formatting
Re: Back-to-front date formatting
- Subject: Re: Back-to-front date formatting
- From: Nicholas Riley <email@hidden>
- Date: Sat, 17 Jan 2004 11:22:49 -0600
- Mail-followup-to: Jeremy Dronfield <email@hidden>, email@hidden
On Sat, Jan 17, 2004 at 11:53:32AM +0000, Jeremy Dronfield wrote:
>
>>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.
This is exactly what the documentation says, no guesswork required:
"If description does not match format exactly, this method returns nil."
If you want to accept lots of different formats, consider using
NSDateFormatter, possibly with the natural language option.
--
=Nicholas Riley <email@hidden> | <
http://www.uiuc.edu/ph/www/njriley>
_______________________________________________
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.