有很多关于date_diff
PHP 函数的问题。但我的似乎有点不同,因为我得到了一个相当不寻常的结果。下面是我的代码:
$today = date( 'd-m-Y', strtotime( "now" ) );
$selectDay = date( 'd-m-Y', strtotime( $row->BOOKING_DATE ));
$interval = date_diff( $selectDay, $today );
我得到的结果是:
Warning: date_diff() expects parameter 1 to be DateTime, string given in...
如您所见,$today 和 $selectDay 都是日期。有什么建议么?注意:我有 PHP 5.3 版