Forum: Ruby Converting a date to mysql format

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
54352f3a32467ff41e04ec4a1280a3ef?d=identicon&s=25 Chris Mohr (chrismohr)
on 2009-04-07 21:00
(Received via mailing list)
Is there an easy way to convert '13-Mar-2009 20:55 PDT' into something
that ruby understands, so that I can output it in a format that mysql
understands?
47b1910084592eb77a032bc7d8d1a84e?d=identicon&s=25 Joel VanderWerf (Guest)
on 2009-04-07 21:28
(Received via mailing list)
Crustov wrote:
> Is there an easy way to convert '13-Mar-2009 20:55 PDT' into something
> that ruby understands, so that I can output it in a format that mysql
> understands?

require 'time'
t = Time.parse '13-Mar-2009 20:55 PDT'
t.strftime("%Y-%m-%d")  # => "2009-03-13"
54352f3a32467ff41e04ec4a1280a3ef?d=identicon&s=25 Chris Mohr (chrismohr)
on 2009-04-07 22:10
(Received via mailing list)
On Apr 7, 12:26 pm, Joel VanderWerf <vj...@path.berkeley.edu> wrote:
>        vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
Awesome. Thanks.
This topic is locked and can not be replied to.