You are here

function _webform_csv_data_time in Webform 6.3

Same name and namespace in other branches
  1. 5.2 components/time.inc \_webform_csv_data_time()
  2. 5 components/time.inc \_webform_csv_data_time()
  3. 6.2 components/time.inc \_webform_csv_data_time()
  4. 7.4 components/time.inc \_webform_csv_data_time()
  5. 7.3 components/time.inc \_webform_csv_data_time()

Implements _webform_csv_data_component().

File

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

Code

function _webform_csv_data_time($component, $export_options, $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 '';
  }
}