Rails 3 default datetime format without UTC

Another — perhaps now preferred — way is to use Rails’ internationalization and localization support. There’s a lot to learn in that guide, so the tl;dr version is this:

<%= l trip.truckleft, :format => :long %>

There are a few predefined date and time formats like :long available to you already for English, and you can add your own in config/locales/en.yml by following the YAML structure in those examples. If you’re not getting heavily into the whole i18n/l10n thing just yet and looking at the l method all the time is confusing, you can also use:

<%= trip.truckleft.to_formatted_s(:long) %>

Leave a Comment