You are here

function timefield_time_to_integer in Timefield 7

Same name and namespace in other branches
  1. 1.0.x timefield.module \timefield_time_to_integer()

Helper function to return integer value offset from midnight from time format.

Parameters

string $value: Time format that should be parsable via date_parse().

5 calls to timefield_time_to_integer()
timefield_feeds_set_target in ./timefield.feeds.inc
Callback for timefield_feeds_processor_targets_alter().
timefield_field_formatter_settings_summary in ./timefield.module
Implements hook_field_formatter_settings_summary().
timefield_time_validate in ./timefield.module
Element validation function
timefield_weekly_summary_build_rows in ./timefield.module
Add rows to the table
_timefield_weekly_summary_build_time_column in ./timefield.module
Helper function to build the time column for the minical table.

File

./timefield.module, line 1049
Defines a Field API field for time

Code

function timefield_time_to_integer($value) {
  $time = date_parse($value);
  $output = 0;
  if ($time['error_count'] == 0) {
    $output += $time['hour'] * 60 * 60;
    $output += $time['minute'] * 60;
    $output += $time['second'];
    return $output;
  }
  else {
    return 0;
  }
}