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?
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
Date.parse
?
http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/date/rdoc/index.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With