2017-08-22 131 views

回答

2

編輯:作爲我研究更多關於回曆日曆,我發現它只有354或355天..所以,你可以通過減去10利用這一天。我會尋找更一致的解決方案。

試試這個..更多DateTime

<?php 
$startDate = new DateTime('1438/01/01'); 
$endDate = new DateTime('1439/01/01'); 

echo ($startDate->diff($endDate))->format("%R%a"); 
0

在Laravel

use Carbon\Carbon; 

然後在代碼中添加此。

$startDate = Carbon::parse('1438/01/01); 
$endDate = Carbon::parse('1439/01/01); 
$dateDiff = $startDate->diff($endDate)->format("%a"); 

echo $dateDiff; 
+0

結果不準確 – uniqueginunphp