Skip to content

Instantly share code, notes, and snippets.

@dannymcc
Created June 13, 2010 16:12
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 dannymcc/436777 to your computer and use it in GitHub Desktop.
Save dannymcc/436777 to your computer and use it in GitHub Desktop.
# Create your own date styles
# environment.rb
ActiveSupport::CoreExtenstions::Time::Conversions::DATE_FORMATS.merge!(
:simple => "%d %b %Y",
:last_login => "Last login: %m/%d/%y at %I:%M %p"
)
# used the same as above
>> now.to_s(:simple)
# => "05 Mar 2007"
>> now.to_s(:last_login)
# => "Last login: 03/05/07 at 06:30 PM"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment