0

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?

Eric Normand
  • 3,806
  • 1
  • 22
  • 26

2 Answers2

1

parsedatetime, always a classic: http://code.google.com/p/parsedatetime/

Adam Vandenberg
  • 19,991
  • 9
  • 54
  • 56
  • This is close, but not nearly as complete as I'd like. – Eric Normand Dec 16 '10 at 13:28
  • It seems that parsedatetime is able to convert the examples of date you provided - so what else do you expect? – ecik Dec 16 '10 at 16:02
  • If parsedatetime is having problems with your test input let me know (or file a bug) and I'll fix it. I wrote it because while mxDateTime does have a lot of features it wasn't able to handle the full range of human input that we needed at the time. – bear Jan 13 '11 at 07:53
  • Does it do "Three days from now"? It didn't work in my tests. – Eric Normand May 23 '11 at 16:01
  • It does but with numeric values - seems it doesn't handle "Three". I'll have to fix that – bear Jun 03 '11 at 04:36
0

I think the best bet here would be the mxDateTime. The documentation seems to suggest that it does what you're looking for.

Nigel
  • 1,695
  • 1
  • 13
  • 22