Parsing text into dates?

John Machin sjmachin at lexicon.net
Tue May 17 19:20:03 EDT 2005


On Tue, 17 May 2005 16:44:12 -0500, Mike Meyer <mwm at mired.org> wrote:

>"Thomas W" <thomas.weholt at gmail.com> writes:
>
>> I'm developing a web-application where the user sometimes has to enter
>> dates in plain text, allthough a format may be provided to give clues.
>> On the server side this piece of text has to be parsed into a datetime
>> python-object. Does anybody have any pointers on this?
>
>Why are you making it possible for the users to screw this up? Don't
>give them a text widget to fill in and you have to figure out what the
>format is, give them three widgets so you *know* what's what.
>
>In doing that, you can also go to dropdown widgets for month, with
>month names (in a locale appropriate for the page language), and for
>the days in the month. 

My experience: drop-down lists generate off-by-one errors. They also
annoy the bejaysus out of users -- e.g. year of birth, a 60+ element
list. It's quite possible of course that YMMV :-)

BTW: I have seen a web page with a drop-down list for year of birth
where the first 18 entries were <current year>, <current year - 1>,
etc for a transaction that wasn't for minors.







More information about the Python-list mailing list