On Mar 8, 12:19 am, rockingred <[EMAIL PROTECTED]> wrote: > Dates can be a pain. I wrote my own date program, simply because > there are so many different ways to write a date: > > Mar 8, 2008 > March 8th, 08 > 03/08/08 > 03-08-2008 > > And so on and so forth. The tricky bit is how to tell the difference > between Day, Month and Year. > > I wrote a program to check the format used for a date. I assumed that > any 4 digits together in a single group were the year. Then I had a > list of Months, with the first 3 characters of each and compared that > to the field being checked, if found, then that was the month. Then I > assumed any number greater than 12 was a day. If I couldn't match > those criteria I assumed Month Day Year (the standard at the company I > worked for).
If humans are sometimes confused about this, how could a computer reliably tells the correct date? I don't think it's possible (to _reliably_ convert string to date), unless you've got an agreed convention on how to input the date. -- http://mail.python.org/mailman/listinfo/python-list