Fabio Santos Fabio Santos - 10 months ago 141
PHP Question

laravel 5 format datetime

I have an array that return the following date time:

$item['created_at'] => "2015-10-28 19:18:44"

And I need this outuput:


Exist any function to convert this date?


Try this:

$dt = new \DateTime('2015-10-28 19:18:44', new \DateTimeZone('Europe/London'));
dd($dt->format('c')); // string '2015-10-28T19:18:44+00:00' (length=25)

Alternatively take a look at Carbon