问题
I'm looking for a function that can convert an English date phrase to some kind of Python date object representing the appropriate date.
An example of the kinds of things I'm looking for (though I'm flexible):
- Three days from now
- yesterday
- In a month
- Next year
- January 18, 2011
- Next Wednesday
Is there such a thing? Is there one perhaps in another language?
回答1:
parsedatetime, always a classic: http://code.google.com/p/parsedatetime/
回答2:
I think the best bet here would be the mxDateTime. The documentation seems to suggest that it does what you're looking for.
来源:https://stackoverflow.com/questions/4458705/flexible-english-date-phrase-library-for-python