Cake\View\Helper\FormHelper::time PHP Method

time() public method

### Options: See dateTime() for time options.
See also: Cake\View\Helper\FormHelper::dateTime() for templating options.
public time ( string $fieldName, array $options = [] ) : string
$fieldName string Prefix name for the SELECT element
$options array Array of Options
return string Generated set of select boxes for time formats chosen.
    public function time($fieldName, array $options = [])
    {
        $options += ['empty' => true, 'value' => null, 'interval' => 1, 'round' => null, 'timeFormat' => 24, 'second' => false];
        $options['year'] = $options['month'] = $options['day'] = false;
        $options = $this->_initInputField($fieldName, $options);
        $options = $this->_datetimeOptions($options);
        return $this->widget('datetime', $options);
    }

Usage Example

 /**
  * Generate time inputs.
  *
  * ### Options:
  *
  * See dateTime() for time options.
  *
  * @param string $fieldName Prefix name for the SELECT element
  * @param array $options Array of Options
  * @return string Generated set of select boxes for time formats chosen.
  * @see Cake\View\Helper\FormHelper::dateTime() for templating options.
  */
 public function time($fieldName, array $options = [])
 {
     $fields = ['hour' => true, 'minute' => true, 'second' => false, 'timeFormat' => false];
     $this->templates(['dateWidget' => $this->_getDatetimeTemplate($fields, $options)]);
     return parent::time($fieldName, $options);
 }
All Usage Examples Of Cake\View\Helper\FormHelper::time