Re: Back-to-front date formatting
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.