Skip to content

Instantly share code, notes, and snippets.

@rmm5t
Last active February 1, 2019 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmm5t/2078da1c89fe925d4391bba6cf7c1696 to your computer and use it in GitHub Desktop.
Save rmm5t/2078da1c89fe925d4391bba6cf7c1696 to your computer and use it in GitHub Desktop.
Example of config/initializers/date_time_formats.rb
Time::DATE_FORMATS[:long_date] = Date::DATE_FORMATS[:long_date] = "%b %e, %Y"
Time::DATE_FORMATS[:day] = Date::DATE_FORMATS[:day] = "%a, %e %b %Y"
Time::DATE_FORMATS[:local_time] = Date::DATE_FORMATS[:local_time] = "%I:%M%P %Z"
Time::DATE_FORMATS[:human] = Date::DATE_FORMATS[:human] = lambda { |t| t.strftime("%b %e, %Y %I:%M%P").sub(/0(\d):/, '\1:') } # Oct 2, 2011 5:57pm
Time::DATE_FORMATS[:rfc822] = "%e %b %Y" # Already in Date::DATE_FORMATS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment