1

I'm about to start working on a simple calendar app for a website I'm working on (using Django, but that fact's probably not relevant).

I'd like users to be able to enter when an event is in a text box like this:

  • Every Sunday evening at 7pm
  • Next Friday
  • Tuesday 1st Dec 2009

and have my application begin to make some guesses as to when they mean. I don't need it to promise to be right, just to be able to present the users with some guesses as to what they mean. Is there a Python library that does some of this? Bonus points if it's extensible to match more formats.

I don't care too much about timezones - for the purposes of my application it's safe to assume any times are in whatever timezone London happens to be in. I'll work that out once I've got some kind of yyyymmddhhiiss representation (or similar).

Apologies if there's a duplicate I've missed - I did have a look.

2 Answers 2

4

There is http://code.google.com/p/parsedatetime/

Sign up to request clarification or add additional context in comments.

4 Comments

It does make me nervous that when I check out from trunk and run the tests, 2 of them fail.
Could you post the errors and file a bug? The author (Mike Tylor code-bear.com/bearlog) works at seesmic and is a very capable coder.
Will do - I'll check tomorrow that I've not screwed something up in the way I've set it up and post back here with a link.
Next time I won't be such a moron, and I'll download the version for the version of Python I have. All tests now pass. Ahem.
2

I proposed a pyparsing solution to this question, which seems similar to yours.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.