- Модуль: timeman
- Путь к файлу: ~/bitrix/modules/timeman/lib/helper/timehelper.php
- Класс: BitrixTimemanHelperTimeHelper
- Вызов: TimeHelper::getUtcTimestampForUserTime
public function getUtcTimestampForUserTime($userId, $daySeconds, $date = null)
{
$timeZone = $this->getUserTimezone($userId);
if (!($timeZone instanceof DateTimeZone))
{
return null;
}
if ($date === null)
{
$date = $this->getUserDateTimeNow($userId);
}
$dateFormatted = $date->format('Y-m-d');
$seconds = str_pad($this->getSeconds($daySeconds), 2, '0', STR_PAD_LEFT);
$dateTime = DateTime::createFromFormat(
'Y-m-d H:i:s',
$dateFormatted . ' ' . $this->convertSecondsToHoursMinutes($daySeconds) . ':' . $seconds,
$timeZone
);
if (!$dateTime)
{
return null;
}
return $dateTime->getTimestamp();
}