How to get the only hours and minutes in laravel blade?

I want to show the date and time separately in my Laravel Blade template. For example, I have the post’s published_at time like "2023-10-11 15:30:00". I want to display the date on one line and the time (hours and minutes) on another line. How can I achieve this?

{{ $post->published_at }}

How can I format this to show the date and time separately?

To show both the date and time separately in Laravel Blade, you can use the Carbon library to parse the string and then format it.

{{ Carbon\Carbon::parse($post->published_at)->format('Y-m-d') }}
{{ Carbon\Carbon::parse($post->published_at)->format('H:i') }}

If you want the time in 12-hour format with AM/PM, use:

{{ Carbon\Carbon::parse($post->created_at)->format('h:i A') }}