Forum: Ruby on Rails help with date formats

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.
66d1d0df01e4bbb82674a353ea68d6ee?d=identicon&s=25 Josh Kieschnick (jjkiesch)
on 2006-06-06 03:42
i have a datetime field in my database that i need broken up. i want to
display the date and the time in separate places. i tried looking
through the api, but couldn't find what i was looking for.

if someone could please point me in the right direction to format dates,
that would be great. thanks
539a351d5e60062693df414e9bbb3465?d=identicon&s=25 Ken Kam (kenkam)
on 2006-06-06 04:20
Josh Kieschnick wrote:
> i have a datetime field in my database that i need broken up. i want to
> display the date and the time in separate places. i tried looking
> through the api, but couldn't find what i was looking for.
>
> if someone could please point me in the right direction to format dates,
> that would be great. thanks

I am not sure if it's the best solution, but I use strftime.
http://www.ruby-doc.org/core/classes/Time.html#M000258
66d1d0df01e4bbb82674a353ea68d6ee?d=identicon&s=25 Josh Kieschnick (jjkiesch)
on 2006-06-06 04:45
worked just fine for me. thanks!
This topic is locked and can not be replied to.