function _webform_csv_data_time in Webform 7.4
Same name and namespace in other branches
- 5.2 components/time.inc \_webform_csv_data_time()
- 5 components/time.inc \_webform_csv_data_time()
- 6.3 components/time.inc \_webform_csv_data_time()
- 6.2 components/time.inc \_webform_csv_data_time()
- 7.3 components/time.inc \_webform_csv_data_time()
Implements _webform_csv_data_component().
File
- components/
time.inc, line 478 - Webform module time component.
Code
function _webform_csv_data_time($component, $export_options, $value) {
if ($value[0]) {
$time = webform_date_array($value[0], 'time');
// An ISO 8601 time is the same as 24-hour time.
if (!empty($export_options['iso8601_time']) || $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 '';
}
}