How can I display a formatted date in Laravel Blade? #56676
-
I'm saving dates in the database in the format YYYY-MM-DD HH:MM:SS, but I want to display them in Blade as d/m/Y. What's the correct way to do this in Laravel? |
Beta Was this translation helpful? Give feedback.
Answered by
victormoni
Aug 17, 2025
Replies: 1 comment 1 reply
-
Hello @rrsilvabr 👋😄 You can use Carbon, which comes integrated with Laravel to handle dates. In your Blade file, you can do this: {{ \Carbon\Carbon::parse($user->created_at)->format('d/m/Y') }} Or, if you already have a date object (Eloquent automatically returns {{ $user->created_at->format('d/m/Y') }} This way, Laravel uses Carbon under the hood to format the date. Reference: Laravel Docs - Dates I hope it helps 🙏 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
rrsilvabr
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @rrsilvabr 👋😄
You can use Carbon, which comes integrated with Laravel to handle dates. In your Blade file, you can do this:
Or, if you already have a date object (Eloquent automatically returns
created_at
as a Carbon instance), you can simply do:This way, Laravel uses Carbon under the hood to format the date.
Reference: Laravel Docs - Dates
I hope it helps 🙏