當我運行下面的PHP代碼:PHP日期時間對象格式DMY錯誤
$this_year_start = strtotime(new DateTime("first day of this year")->format('d/m/Y'));
$this_year_end = strtotime(new DateTime("last day of this year")->format('d/m/Y'));
我收到以下錯誤:
PHP Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /home/admin/data.php on line 164
我想今年開始的UNIX時間今年結束。但是這似乎有一些問題格式,並將其轉換爲unix時間。
替換'和'date_create'新Datetime',但我懷疑, 「今年的第一天」被接受爲論點。 – fusion3k