How to get the first day of the current year?

后端 未结 11 1841
再見小時候
再見小時候 2020-12-09 14:48

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);
<         


        
11条回答
  •  余生分开走
    2020-12-09 15:05

    Or use only text in the strtotime function:

    date('Y-m-d', strtotime('first day of january this year'));
    

提交回复
热议问题