Tag Archives: initializers

Rails Helper to Remove Leading Zero in 12 Hour Time Format

I can’t find a strftime() format that will output the hour without the leading zero. For instance 6:20 will be instead 06:20. This just looks a little sloppy. I created a datetime.rb intializer which will contain custom datetime formats for my application. # RAILS_ROOT/config/initializers/datetime.rb Time::DATE_FORMATS[:date] = "%a %b %d, %Y" Time::DATE_FORMATS[:time] = "%I:%M%p" # ... Next I set up [...]
Posted in Ruby on Rails | Also tagged , , , , | 1 Comment