--- helpers_form.module	2008-02-13 10:31:19.000000000 -0500
+++ helpers_form.module	2008-06-03 01:37:03.000000000 -0400
@@ -165,6 +165,36 @@ function add_none_to_options($options, $
 }
 
 /**
+ * Create a form-structure filled with time choices.
+ * @param $select, Which part of time to select.
+ *   'hour' will return the select for hours.
+ *   'minute' will return the select for minutes.
+ *   'second' will return the select for seconds.
+ *   'ampm' will return the select for AM or PM.
+ * @param $hour, if this is TRUE, then if 'hour' is selected, it will return a set approriate for a 24 hour clock (0-23).
+ * @param $title, the title of the form. Defaults to "Time".  Any option will be translated as well.
+ * @param $default_value, the selected time.
+ * @param $required, whether or not the field will be required.
+ * @param $description, optionally provide a description. it Is translated.
+ * @param $multiple, whether or not to allow multiple choices.
+ * @return form element ready to add to form.
+ */
+function time_select_for_form($select, $hour = FALSE, $title = 'Time', $default_value = NULL, $required = FALSE, $description = '', $multiple = FALSE){
+	
+   $options = _time_options($hour);
+	
+   return array(
+      '#type' => 'select',
+      '#title' => t($title),
+      '#options' => $options[$select],
+      '#default_value' => $default_value,
+      '#required' => $required,
+      '#multiple' => $multiple,
+      '#description' => t($description),
+   );
+}
+
+/**
  * Helper helpers. Private functions that are used internally
  */
 /**
@@ -491,3 +521,28 @@ function _helpers_data_month_names_array
     );
   return $names;
 }
+
+function _time_options($hour){
+
+   $time = array('hour', 'minute', 'second', 'ampm');
+   if($hour == TRUE)
+      for($i=1;$i<=12;$i++)
+         ($i < 10 ? $time['hour']["$i"] = "0$i" : $time['hour'][$i] = "$i");
+   else
+      for($i=0;$i<=23;$i++)
+         ($i < 10 ? $time['hour']["$i"] = "0$i" : $time['hour'][$i] = "$i");
+
+   for($i = 0; $i < 60; $i++)
+      ($i < 10 ? $time['minute']["$i"] = "0$i" : $time['minute']["$i"] = "$i");
+
+   for($i = 0; $i < 10; $i++)
+      ($i < 10 ? $time['second']["$i"] = "0$i" : $time['second']["$i"] = "$i");
+
+   $time['ampm'] = array(
+      'am' => 'AM',
+      'pm' => 'PM'
+      );
+      
+   return $time;
+   
+}
