Re: NSDateFormatter : SOLVED
Re: NSDateFormatter : SOLVED
- Subject: Re: NSDateFormatter : SOLVED
- From: Ali Lalani (list) <email@hidden>
- Date: Wed, 21 Aug 2002 13:37:54 -0400
On Wednesday, August 21, 2002, at 12:50 PM, Itrat Khan wrote:
Both the parsing and display of dates is dictated by your format, so I'm
not sure how the parsing is not to be confused with dateFormat.
I haven't found this to be the case...for instance, a quick example i
put together just now, my custom format on a textfield is %d/%B/%y(day
of month, full month name, year)
if i run it and type in the textfield: "01/02/02" which i would like it
to interpret as the 1st of February, 2002, it changes it to
02/January/02...no matter what my format is it will always read the
first ambiguous number as the month and the second as the day. However,
i believe i may have found the solution to this, to implement in a
subclass. At first, i thought NSDateFormatter did the parsing, but it's
actually NSDate which parses it, and there's an option in the function
[NSDate dateWithNaturalLanguageString:locale:].
One of the keys in locale can be "NSDateTimeOrdering" in which you can
specify the order in which ambiguous date numbers are to be parsed,
MDYH(month, day, year, hour) or DMYH(day,month,year,hour). I haven't
tried to implement this yet, but it seems like it is the solution...
Ali Lalani
e-mail: email@hidden
_______________________________________________
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.