On Jul 6, 7:21 pm, m...@pixar.com wrote: > I'm looking for something like Tcl's [clock scan] command which parses > human-readable time strings such as: > > % clock scan "5 minutes ago" > 1246925569 > % clock scan "tomorrow 12:00" > 1246993200 > % clock scan "today + 1 fortnight" > 1248135628 > > Does any such package exist for Python? > > Many TIA! > Mark > > -- > Mark Harrison > Pixar Animation Studios
I've been dabbling with such a parser with pyparsing - here is my progress so far: http://pyparsing.wikispaces.com/UnderDevelopment It parses these test cases: today tomorrow yesterday in a couple of days a couple of days from now a couple of days from today in a day 3 days ago 3 days from now a day ago now 10 minutes ago 10 minutes from now in 10 minutes in a minute in a couple of minutes 20 seconds ago in 30 seconds 20 seconds before noon 20 seconds before noon tomorrow noon midnight noon tomorrow -- Paul -- http://mail.python.org/mailman/listinfo/python-list