• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/Calc/Libs/DateLib.php
  • Класс: BitrixBizprocCalcLibsDateLib
  • Вызов: DateLib::callDateDiff
public function callDateDiff(Arguments $args)
{
	$date1 = $args->getFirstSingle();
	$date2 = $args->getSecondSingle();
	$format = $args->getThird();

	if (!$date1 || !$date2 || !is_scalar($format))
	{
		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);
}