Forum: Ruby on Rails 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 22:45
(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?

Thanks,
Chris
Phlip (Guest)
on 2009-04-07 22:55
(Received via mailing list)
Chris.Mohr 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?

Does this work?

t = Time.parse('13-Mar-2009 20:55 PDT')
p t.to_s(:db)
This topic is locked and can not be replied to.