I wonder if there is a “right” way to call:
$endDate = new DateTime('first day of next year');
I know that the PHP parser expects a month later
of( see here ), but next yearit seems to work as intended. If the month is May, he will declare April 1 of next year how $endDate.
Of course, we can hack this with:
$endDate = new DateTime('first day of january');
$endDate = $endDate->modify('+1 year');
But I can not imagine that no one fixed this error, since PHP 5.3 came out 7 years ago.
Loek source
share