I need to use PHP DateTime to get the first day of the current year. I\'ve tried:
$year = new DateTime(\'first day of this year\');
var_dump($year);
<
Your relative date format 'first day of this year' is correct by returning the first day of the month because of the definition of first day of:
Sets the day of the first of the current month. This phrase is best used together with a month name following it. (See PHP-doc)
To get the first day of the current year with the relative format you can use something like this:
'first day of January ' . date('Y')