Python markup blur

Is there a Python module for interpreting fuzzy timestamps, such as the date command in unix:

> date -d "2 minutes ago"
Tue Aug 11 16:24:05 EST 2009

The closest I've found so far is dateutil.parser, which is not suitable for the above example.

thanks

+5
source share
2 answers

Check out this open source module: parsedatetime

+8
source

I do this using pyparsing - you can find my last attempt here . It works for 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
+1
source

All Articles