Converts a time HH:MM:SS into seconds (php)

2016/08/28 23:22:08
Author Profile Picture

posted by

@florianpreusner

Converts a time HH:MM:SS in seconds


/**
 * Converts a time HH:MM:SS into seconds
 *
 * @param  string $time
 * @return integer
 */
function convertGermanTimeToSeconds($time) {

  list($hours, $minutes) = explode(':', $time);
  return ((int) $hours * 60 * 60 + (int) $minutes * 60);
}
Share on Google+