puiu91
1/18/2016 - 5:52 PM

gistfile1.txt

        // output date with current year set at first day of year
        $currentYearStartDate = $this->DateTime->setDate(
            $this->DateTime->format('Y'), 1, 1
        )->format('Y-m-d');




        // output date with previous year and current day
        $previousYearEndDate = $this->DateTime->setDate(
            $this->DateTime->format('Y'), 1, 1
        )->format('Y-m-d');

        // output date with previous year set at first day of year
        $previousYearStartDate = $this->DateTime->sub(
            new DateInterval('P12M')
        )->format('Y-m-d');