How to parse unpredictable date strings [WAS: Two digit dates with NSDateFormatter]
How to parse unpredictable date strings [WAS: Two digit dates with NSDateFormatter]
- Subject: How to parse unpredictable date strings [WAS: Two digit dates with NSDateFormatter]
- From: Matthew Lindfield Seager <email@hidden>
- Date: Fri, 9 Oct 2009 00:32:52 +1100
For some reason I didn't think to test with a style that uses a two digit
year. It works as advertised with the short style. The docs say "The
earliest date that can be denoted by a two-digit year specifier". I guess
that since the medium and long styles don't have a "two-digit year
specifier" associated with them it can't know my "09" isn't supposed to mean
0009.
I'm probably just making excuses now but the term "specifiers" seems to be
specific (no pun intended) to the pre 10.4 behaviour. From 10.4 onwards we
seem to have "format patterns".
Regardless of semantics, I read the description numerous times and never
once realised that "specifier" had nothing to do with the input. Should I
file a documentation bug or is the current description of that method
perfectly clear to everyone else?
Which makes me now ask, how does everyone else parse unpredictable user
input? Do I just try one format after another until I get a non-null date
(and hope the interpreted date was what the user meant) or do I go back to
the "not recommended" natural language formatting?
Apologies if I was (am?) just being dense!
Matt
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden