-2

I would like to convert something like "2020-01-01 00:00:00" into "Wed, Jan 1, 2020". Is there a way to do this in laravel?

4

2 回答 2

1

Try this

date('D, M j,Y', strtotime($user->created_at));
于 2020-09-28T00:59:37.677 回答
0

Laravel uses Carbon library out of the box, so you can get what you want just using it:

{{ $user->created_at->toDayDateTimeString() }}

于 2020-09-28T02:23:05.687 回答