我有这样的代码
$awal = date_create('$value[tgl_kembali]');
$akhir = date_create(); // waktu sekarang
$diff = date_diff($awal, $akhir);
echo 'Total selisih hari : ' . $diff->days;
使用这段代码,我想获得不同日期的表单变量,$awal该变量是数据数组$akhir,并且我有这样的错误:
Warning: date_diff() expects parameter 1 to be DateTimeInterface, bool given in C:\xampp\htdocs\Travel.remove\Travel\admin\pesanan.php on line 54
Notice: Trying to get property 'days' of non-object in C:\xampp\htdocs\Travel.remove\Travel\admin\pesanan.php on line 55
红颜莎娜