PEP 321: Date/Time Parsing and Formatting
Paul Moore
pf_moore at yahoo.co.uk
Tue Nov 18 16:36:43 EST 2003
"John Roth" <newsgroups at jhrothjr.com> writes:
> The trouble with "guess the format" is that it's not possible
> to do it correctly in the general case from one sample.
> Given enough samples of one consistent format, it's
> certainly possible. However, that's a two pass process.
I think you can do it with a hint or two. The key one is whether in
ambiguous cases, you choose DD/MM or MM/DD. You need a second hint
with 2-digit years, as 01-02-03 is *very* ambiguous (given that
putting the year in the middle is insane, you only need a flag saying
whether the year is at the start or the end).
I'm not sure what other ambiguities you'd need to cater for?
Paul.
--
This signature intentionally left blank
More information about the Python-list
mailing list