how make date string date object in php using 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);
error:
trying property of non-object
normal value of string:
string(19) "2016-02-05 14:51:30"
any ideas how fix it? think need make string date object. thank you.
using $dates
property in order
model:
protected $dates = ['order_creation_date'];
Comments
Post a Comment