如何使用Carbon在PHP中使日期字符串變爲日期對象?字符串日期對象PHP Laravel Carbon
$minTime = DB::table('order')
->select('order_creation_date', 'restaurant_id')
->where('restaurant_id', '=', '70')
->orderBy('order_creation_date', 'asc')
->first();
$m = $orderDay -> month;
$d = $orderDay -> day;
$y = $orderDay -> year;
$y = (int)$y;
$d = (int)$d;
$m = (int)$m;
$orderDay = $minTime -> order_creation_date;
var_dump($orderDay);
錯誤:
Trying to get property of non-object
普通字符串的值:
string(19) "2016-02-05 14:51:30"
任何想法如何解決呢?我想我需要使字符串到日期對象。謝謝。
不工作; // –
@ arnas-puidokas更新..再次檢查 –
錯誤中的尾隨數據 –