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

	// todo: could be other formats, i.e. with T placeholder...

	$printFFormat = '%02d:%02d:%02d';
	if($format == 'HH:MI')
	{
		$printFFormat = '%02d:%02d';
	}

	if(!is_numeric($time))
	{
		return '';
	}

	$sign = $time < 0 ? '-' : '';
	$time = abs($time);

	return $sign.sprintf(
		$printFFormat,
		floor($time / 3600),	// hours
		floor($time / 60) % 60,	// minutes
		$time % 60				// seconds
	);
}