You are here

function _webform_table_time in Webform 7.3

Same name and namespace in other branches
  1. 6.3 components/time.inc \_webform_table_time()
  2. 7.4 components/time.inc \_webform_table_time()

Implements _webform_table_component().

File

components/time.inc, line 364
Webform module time component.

Code

function _webform_table_time($component, $value) {
  if ($value[0]) {
    $time = webform_date_array($value[0], 'time');
    if ($component['extra']['hourformat'] == '24-hour') {
      return sprintf('%02d', $time['hour']) . ':' . sprintf('%02d', $time['minute']);
    }
    else {
      $time = webform_time_convert($time, '12-hour');
      return $time['hour'] . ':' . sprintf('%02d', $time['minute']) . ' ' . $time['ampm'];
    }
  }
  else {
    return '';
  }
}