views:

120

answers:

2

Has anyone come across a script / cl app written in any language that handles the parsing of human-entered dates well? I'd love to be able to parse, for example:

  • "3 to 4 weeks"
  • "2 - 3 days"
  • "3 weeks to 2 months"
+4  A: 

The Chronic gem for ruby will allow you to express dates in a natural form.

Some examples of supported forms (from the documentation)

  thursday
  november
  summer
  friday 13:00
  mon 2:35
  4pm
  yesterday at 4:00
  last friday at 20:00
  last week tuesday
  tomorrow at 6:45pm
  afternoon yesterday
  thursday last week
  3 years ago
  5 months before now
  7 hours ago
  7 days from now
  1 week hence
  in 3 hours
  1 year ago tomorrow

I have not used it so can not comment on its performance.

Steve Weet