• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/calc.php
  • Класс: CBPCalc
  • Вызов: CBPCalc::functionDateDiff
private function functionDateDiff($args)
{
	if (!is_array($args))
		$args = [$args];

	$ar = $this->ArrgsToArray($args);
	$date1 = array_shift($ar);
	$date2 = array_shift($ar);
	$format = array_shift($ar);

	if ($date1 == null || $date2 == null)
		return null;

	$date1Formatted = $this->getDateTimeObject($date1);
	$date2Formatted = $this->getDateTimeObject($date2);
	if ($date1Formatted === false || $date2Formatted === false)
	{
		return null;
	}

	$interval = $date1Formatted->diff($date2Formatted);

	return $interval === false ? null : $interval->format($format);
}