--- title: Rails helpers layout: default --- ### Date helpers http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html ### Date distance_of_time_in_words(Time.now, project.end_date) #=> 3 hours distance_of_time_in_words_to_now project.end_date #=> 3 hours ### Time select # Creates a time select tag that, when POSTed, will be stored in the article # variable in the sunrise attribute. time_select "article", "start_time" # All options are optional time_select "article", "start_time", \ :include_seconds => true, :minute_step => 15, :prompt => true, :prompt => { :hour => "Choose hr", :minute => "Choose min", :second => "Choose sec" }, :ampm => true # For dates (all options are optional) date_select "article", "written_on", \ :start_year => 1995, :use_month_numbers => true, :discard_day => true, :include_blank => true, :order => [:day, :month, :year], :default => 3.days.from_now, :default => { :day => 20 }, :prompt => { :day => 'Select day', :month => 'Select month', :year => 'Select year' } ### Time tag time_tag Date.today #=>