-2
I am developing a Portable application where there is a Rest Api that needs to send some values, one of them being a datetime. Access Models with the following command:
['registerDate' => $anuncio->created_at]
I happen to be returned the following amount:
Carbon @1536805969 {#461 ▼
date: 2018-09-12 23:32:49.0 America/Sao_Paulo (-03:00)
}
In the application documentation that will receive the data specifies that I need to send the data in json like this:
"registerDate": "2017-10-27T13:09:22.780Z",
I made a function that handles the data returned by Carbon:
$date = (
implode(' ', array(
explode(' ', $anuncio->created_at)[0],
explode(' ', $anuncio->created_at)[1])));
That returns the string:
"2018-09-12 23:32:49"
But the documentation specifies that the format should be datetime. Does anyone know any function or way to get the date in the requested format?