A Natural Language Date/Time Parser for Ruby: chronic
Posted by Daniel Butler Sun, 10 Sep 2006 23:00:00 GMT
Chronic is a natural language date/time parser written in pure Ruby.
require 'chronic'
Time.now #=> Sun Aug 27 23:18:25 PDT 2006
#---
Chronic.parse('tomorrow')
#=> Mon Aug 28 12:00:00 PDT 2006
Chronic.parse('monday', :context => :past)
#=> Mon Aug 21 12:00:00 PDT 2006
Chronic.parse('this tuesday 5:00')
#=> Tue Aug 29 17:00:00 PDT 2006
Chronic.parse('this tuesday 5:00', :ambiguous_time_range => :none)
#=> Tue Aug 29 05:00:00 PDT 2006
Chronic.parse('may 27th', :now => Time.local(2000, 1, 1))
#=> Sat May 27 12:00:00 PDT 2000
Chronic.parse('may 27th', :guess => false)
#=> Sun May 27 00:00:00 PDT 2007..Mon May 28 00:00:00 PDT 2007Chronic uses Ruby’s built in Time class for all time storage and computation. Because of this, only times that the Time class can handle will be properly parsed. Parsing for times outside of this range will simply return nil. Support for a wider range of times is planned for a future release.
Time zones other than the local one are not currently supported. Support for other time zones is planned for a future release.


It is a really nice gem. I used it for my own little logging script (http://www.h3rald.com/articles/redbook), and works very well!
hey there, great info avialble here… I was searching for all chronic related functions though.