mardi 26 juillet 2016

how to assign created_at only date string in laravel

I Have a problem with the created_at and other carbon dates, when I do

return $return_items['created_date'] = $item->created_at;

It returns '2016-07-26 13:19:55'

but if I do

return $return_items;

it returns

"created_date": {
   "date": "2016-07-26 13:22:17.000000"
   "timezone_type": 3
   "timezone": "UTC"
}

How can I solve this, to only show the string date?

thanks



via Chebli Mohamed

1 commentaire:

Kron0S a dit…

return $return_items['created_date'] = (string)$item->created_at;

Enregistrer un commentaire