Returns a set of html select-tags (one for hour and minute) You can set :time_separator key to format the output, and the :include_seconds option to include an input for seconds.
Examples
my_time = Time.now + 5.days + 7.hours + 3.minutes + 14.seconds # Generates a time select that defaults to the time in my_time select_time(my_time) # Generates a time select that defaults to the current time (no specified time) select_time() # Generates a time select that defaults to the time in my_time, # which has fields separated by ':' select_time(my_time, :time_separator => ':') # Generates a time select that defaults to the time in my_time, # that also includes an input for seconds select_time(my_time, :include_seconds => true) # Generates a time select that defaults to the time in my_time, that has fields # separated by ':' and includes an input for seconds select_time(my_time, :time_separator => ':', :include_seconds => true)
Source Code
# File action_view/helpers/date_helper.rb, line 310 def select_time(datetime = Time.now, options = {}) separator = options[:time_separator] || '' select_hour(datetime, options) + separator + select_minute(datetime, options) + (options[:include_seconds] ? separator + select_second(datetime, options) : '') end
<code/>and<pre/>for code samples.