You are here

function _webform_table_data_time in Webform 5

Same name and namespace in other branches
  1. 5.2 components/time.inc \_webform_table_data_time()
  2. 6.2 components/time.inc \_webform_table_data_time()

Return the result of this component's submission for display in a table. The output of this function will be displayed under the "results" tab then "table".

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 human reading.

File

components/time.inc, line 274

Code

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