- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar.php
- Класс: CCalendar
- Вызов: CCalendar::GetOriginalDate
static function GetOriginalDate(
$parentDateTime,
$instanceDateTime,
$timeZone = null,
$format = null
): string
{
CTimeZone::Disable();
$format = $format ?? MainTypeDate::convertFormatToPhp(FORMAT_DATETIME);
$parentTimestamp = Util::getDateObject($parentDateTime, false, $timeZone)->getTimestamp();
$baseTimeZone = date_default_timezone_get();
if ($timeZone)
{
date_default_timezone_set($timeZone);
}
$parentInfoDate = getdate($parentTimestamp);
/** @var TypeDateTime $instanceDateTime */
$instanceDateTime = Util::getDateObject($instanceDateTime, false, $timeZone);
$eventDate = $instanceDateTime->setTime($parentInfoDate['hours'], $parentInfoDate['minutes'])->format($format);
if ($baseTimeZone)
{
date_default_timezone_set($baseTimeZone);
}
CTimeZone::Enable();
return $eventDate;
}