Ejemplo n.º 1
0
 static function getLocalOffset()
 {
     $now = Date::now();
     $local = null;
     $year = $now->getFullYear();
     $month = $now->getMonth() + 1;
     $day = $now->getDate();
     $hour = $now->getHours();
     $minute = $now->getMinutes();
     $second = $now->getSeconds();
     $time = datetime_utils_DateTimeUtils::yearToStamp($year) + datetime_utils_DateTimeMonthUtils::toSeconds($month, _hx_mod($year, 4) === 0 ? datetime__DateTime_DateTime_Impl__1($day, $hour, $local, $minute, $month, $now, $second, $year) : false) + ($day - 1) * 86400 + $hour * 3600 + $minute * 60 + $second - 62135596800.0;
     $local = $time + 62135596800.0;
     return Std::int($local - 62135596800.0 - Std::int($now->getTime() / 1000));
 }
Ejemplo n.º 2
0
 static function addYear($dt, $amount)
 {
     $year = datetime__DateTime_DateTime_Impl_::getYear($dt) + $amount;
     $time = $dt - 62135596800.0 - (datetime__DateTime_DateTime_Impl_::yearStart($dt) + datetime_utils_DateTimeMonthUtils::toSeconds(datetime_utils_DateTimeUtils_1($amount, $dt, $year), datetime__DateTime_DateTime_Impl_::isLeapYear($dt)));
     return datetime_utils_DateTimeUtils::yearToStamp($year) + datetime_utils_DateTimeMonthUtils::toSeconds(datetime_utils_DateTimeUtils_2($amount, $dt, $time, $year), _hx_mod($year, 4) === 0 ? datetime_utils_DateTimeUtils_3($amount, $dt, $time, $year) : false) + $time - 62135596800.0;
 }