Skip to content

Instantly share code, notes, and snippets.

@rafamvc
Created March 20, 2014 16:53
Show Gist options
  • Save rafamvc/9668497 to your computer and use it in GitHub Desktop.
Save rafamvc/9668497 to your computer and use it in GitHub Desktop.
Formatting Time and Date locale
en:
date:
formats:
default: "%m/%d/%Y"
short: "%m/%d"
datetime:
formats:
default: "%m/%d/%Y %H:%M"
short: "%H:%M"
notime: "%m/%d/%Y"
time:
formats:
default: "%m/%d/%Y %H:%M"
short: "%H:%M"
notime: "%m/%d/%Y"
...
<td><%= I18n.l(my_model.time_to_be_formatted, :short) %></td>
...
...
<td><%= I18n.l(my_model.date) %></td>
...
...
<td><%= I18n.l(my_model.time_to_be_formatted, :notime) %></td>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment