Laravel 8 - Change Date Format Using Jenssegers/Date Package

Nov 12, 2021 . Admin

Hi Friends,

In this article i will let you know how to change date format using jenssegers/date composer package in Laravel 8. jenssegers/date package provide us Date facade. Date facade through we can simply change date formate, calculate difference between two dates its.

jenssegers/date package provide amazing feature is multi-language support. If you want to display your date in specific language then they are support almost languages as listed here : Albanian, Arabic, Azerbaijani, Bangla, Basque, Brazilian Portuguese, Bulgarian, Catalan, Croatian etc.

You can simply use this plugin and it's amazing. So you have to just follow bellow example.

First of all you need required jenssegers/date package install.

Install Package:

now we have to install jenssegers/date composer package for date facade. So simply run bellow composer command for install package.

composer require jenssegers/date

After install successfully above jenssegers/date package we need to add into providers and aliases array of configuration file. So let's add following way:


return [
    'providers' => [
    'aliases' => [
        'Date' => Jenssegers\Date\Date::class,
Simple Example of Language Support:
Route::get('date-formate', function () {
    $date = Date::now()->format('l j F Y H:i:s');

Change Date Format:
Route::get('date-formate', function () {
    $date = Date::parse('2021-12-12 01:01:10')->format('l j F Y');

zo. 12 december 2021

I hope you found your best solution...

#Laravel 8 #Laravel