Parsing text into dates?

Peter Hansen peter at engcorp.com
Mon May 16 19:11:38 EDT 2005


John Machin wrote:
> If this application is being deployed from a central server where the
> users can be worldwide, you have two options:
> 
> (a) try to work out somehow what the user's locale is, and then work
> with dates in the legacy format "appropriate" to the locale.

And this inevitably screws a large number of Canadians (and probably 
others), those poor conflicted folk caught between their European roots 
and their American neighbours, some of whom use mm/dd/yy and others of 
whom use dd/mm/yy on a regular basis.  And some of us who switch 
willy-nilly, much as we do between metric and imperial. :-(

> (b) Use the considerably-less-stupid ISO 8601 standard format
> yyyy-mm-dd (e.g. 2004-12-01) -- throughout your web-application, not
> just in your data entry. 

+1 (emphatically!)  (I almost always use this form even on government 
submissions, and nobody has complained yet.  Of course, they haven't 
started changing the forms yet, either...)

-Peter



More information about the Python-list mailing list