src/LocalDate.php
public function toEpochDay() : int
    {
        $y = $this->year;
        $m = $this->month;

        $total = 365 * $y;

        if ($y >= 0) {
            $total += \intdiv($y + 3, 4) - \intdiv($y + 99, 100) + \intdiv($y + 399, 400);
        } else {
            $total -= \intdiv($y, -4) - \intdiv($y, -100) + \intdiv($y, -400);
        }

        $total += \intdiv(367 * $m - 362, 12);
        $total += $this->day - 1;

        if ($m > 2) {
            $total--;
            if (! $this->isLeapYear()) {
                $total--;
            }
        }

        return $total - self::DAYS_0000_TO_1970;
    }
public function toEpochDay() : int
    {
        $y = $this->year;
        $m = $this->month;

        $total = 365 * $y;

        if ($y >= 0) {
            $total += \intdiv($y + 3, 4) - \intdiv($y + 99, 100) + \intdiv($y + 399, 400);
        } else {
            $total -= \intdiv($y, -4) - \intdiv($y, -100) + \intdiv($y, -400);
        }

        $total += \intdiv(367 * $m - 362, 12);
        $total += $this->day - 1;

        if ($m > 2) {
            $total--;
            if (! $this->isLeapYear()) {
                $total--;
            }
        }

        return $total - self::DAYS_0000_TO_1970;
    }
public function toEpochDay ( ) : int { $ y = $ this -> year ; $ m = $ this -> month ; $ total = 365 * $ y ; if ( $ y >= 0 ) { $ total += \ intdiv ( $ y + 3 , 4 ) - \ intdiv ( $ y + 99 , 100 ) + \ intdiv ( $ y + 399 , 400 ) ; } else { $ total -= \ intdiv ( $ y , - 4 ) - \ intdiv ( $ y , - 100 ) + \ intdiv ( $ y , - 400 ) ; } $ total += \ intdiv ( 367 * $ m - 362 , 12 ) ; $ total += $ this -> day - 1 ; if ( $ m > 2 ) { $ total -- ; if ( ! $ this -> isLeapYear ( ) ) { $ total -- ; } } return $ total - self :: DAYS_0000_TO_1970 ; }
Returns the number of days since the UNIX epoch of 1st January 1970.

@return int
Returns the number of days since the UNIX epoch of 1st January 1970 .