• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/ui.php
  • Класс: BitrixTasksUI
  • Вызов: UI::parseTimeAmount
static function parseTimeAmount($time, $format = 'HH:MI:SS')
{
	$time = trim((string) $time);

	if($time == '')
	{
		return 0;
	}

	// todo: stop ignoring $format here
	$found = array();
	if(!preg_match('#^(d{1,2}):(d{1,2})?$#', $time, $found))
	{
		return 0;
	}

	$h = intval($found[1]);
	$m = intval($found[2]);

	if(($h < 0 || $h > 23 || $m < 0 || $m > 59))
	{
		return 0;
	}

	return $h*3600 + $m*60;
}