Reputation: 28499
I believe that older versions of ruby came with a parsedate
module that allowed best-guess passing of date/time strings. This doesn't seem to be in ruby 1.9 -- is there an equivalent piece of functionality elsewhere?
Upvotes: 10
Views: 5770
Reputation: 91
Had the same problem myself. Looking at the 1.8 source parsetime uses another module which is still around. The following works for me using Ruby 1.9 built from ports on FreeBSD.
require 'date/format' require 'time' text = "Tue Jun 28 11:58 2011" array = Date._parse(text, false).values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :wday) time = Time.mktime(*array) puts time
Upvotes: 9
Reputation: 4478
Date.parse
?
http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/date/rdoc/index.html
Upvotes: 8