Follow Along as I Stumble on the Path to Learning RoR

Posts tagged “format

Common Formatting Helpers

Adding  a list of some of the Rails formatting helpers I often have to use:

  • Converting a number to a dollar amount -> number_to_currency(field_value)
  • Changing the date to US date format (MM/DD/YYYY) -> field_value.strftime(“%m/%d/%Y”)
  • Converting to a percentage -> number_to_percentage(field_value)

For additional helpers with numbers here’s the link to the Rails API for number helpers


Formatting Date Display in Rails

I needed help in formatting time in Rails and found here in the strftime( string ) → string section.  In particular, I wanted to change the default timestamp (created_at) to an American format MM/DD/YYYY.



resources for using jqgrid with Rails



formatters available for jqgrid (use to format the data showing in jqgrid)

US Date Format

My dates were displaying DD-MM-YYYY, but I wanted to display it MM/DD/YYYY.

Here’s an easy way to do that.