i have a field in my model called creation_time whose type is datetime.
so echo $model->creation_date;die();
will display a value like this
2015-10-07 09:55:17
i want to get only the date ie, 2015-10-07.How can i do that? i have tried something like this
$d = date('Y-m-d', $model->creation_date);
echo $d ; die();
but i got an error which says A non well formed numeric value encountered
then i tried like this
$s = $model->creation_date;
$dt = new DateTime($s);
$date = $dt->format('m/d/Y');echo $date; die();
now i get error like this 'app\controllers\DateTime' not found