• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/util/scheduler.php
  • Класс: Bitrix\Tasks\Util\is
  • Вызов: is::castToDateTimeGmt
static function castToDateTimeGmt($date)
{
	if($date == null)
	{
		return null;
	}

	if(is_string($date))
	{
		// $date is treated as LOCAL TIME, since we have no information about time zone
		return DateTime::createFromUserTimeGmt($date);
	}
	elseif($date instanceof \Bitrix\Main\Type\DateTime)
	{
		// to local time ...
		$date = $date->toString();

		// .. and return as gmt
		return DateTime::createFromUserTimeGmt($date);
	}
	else
	{
		throw new \Bitrix\Main\ArgumentException('Unsupported type of date');
	}
}