You are here

function _webform_csv_data_time in Webform 6.2

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.3 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()

Return the result of a textfield submission. The output of this function will be displayed under the "results" tab then "submissions".

Parameters

$data: An array of information containing the submission result, directly correlating to the webform_submitted_data database schema.

Return value

Textual output formatted for CSV, not including either prefixed or trailing commas.

File

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

Code

function _webform_csv_data_time($data, $component) {
  if (drupal_strlen($data['value']['0']) > 0 && drupal_strlen($data['value']['1']) > 0) {
    $timestamp = strtotime($data['value']['0'] . ':' . $data['value']['1'] . $data['value']['2']);
    if ($component['extra']['hourformat'] == '24-hour') {
      return date('H:i', $timestamp);
    }
    else {
      return date('g:i a', $timestamp);
    }
  }
  else {
    return '';
  }
}