• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/Calc/Libs/DateLib.php
  • Класс: BitrixBizprocCalcLibsDateLib
  • Вызов: DateLib::getDateTimeObject
private function getDateTimeObject($date)
{
	if ($date instanceof BizprocBaseTypeValueDate)
	{
		return (new DateTime())->setTimestamp($date->getTimestamp());
	}
	elseif (is_array($date))
	{
		$date = CBPHelper::flatten($date);
	}

	if (!is_scalar($date))
	{
		return false;
	}

	$df = MainTypeDateTime::getFormat();
	$df2 = MainTypeDate::getFormat();
	$date1Formatted = DateTime::createFromFormat($df, $date);
	if ($date1Formatted === false)
	{
		$date1Formatted = DateTime::createFromFormat($df2, $date);
		if ($date1Formatted)
		{
			$date1Formatted->setTime(0, 0);
		}
	}
	return $date1Formatted;
}