Hi, I'm new to Laravel and Livewire and I 'm having too much trouble understanding how to format a date in addition to this. I find very little information. Can you give me a hand with my code?
Where I show my dates I have it like this:
@foreach ($changelogs as $value)
<h1 class="text-md font-extrabold ">{{$value->created_at}}</h1>
@endforeach
Where I retrieve my data from the database to show them in the view I have it like this.
public function render()
{
$changelogs = Changelog::all();
return view('livewire.changelog-component', compact('changelogs'));
}
De antemano gracias espero me puedan ayudar.
Try this:
It will convert the date to the format
d-m-Y
you gave it.Note: This solution is a general solution that works for php and any of its frameworks. For a Laravel-specific method, try the solution provided by Hamelraj .