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.
Chris M. (Guest)
on 2009-04-07 23: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?
Joel VanderWerf (Guest)
on 2009-04-07 23: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"
Chris M. (Guest)
on 2009-04-08 00:10
(Received via mailing list)
On Apr 7, 12:26 pm, Joel VanderWerf <removed_email_address@domain.invalid> 
wrote:
>        vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
Awesome. Thanks.
This topic is locked and can not be replied to.