Date Serialization

Posted 2 months ago by neeonline

Hello,

I want to have all dates returned from my requests to have a specific format. I followed the documentation at https://laravel.com/docs/5.8/eloquent-serialization#date-serialization

So, in my AppServiceProvider inside the method boot() I have:

Carbon::serializeUsing(function ($carbon) {
    return $carbon->format('Y-m-d\TH:i:s.uP T');
});

But all the dates are still returning in the format Y-m-d i:s:u

What am I doing wrong?

Thank you.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.