Hijri is a package that helps you to convert the Gregorian date to a Hijri date, and it's available in multiple languages.
For example : Convert Tuesday, May 25, 2021 7:00 PM To Tuesday, Shawwal 13, 1442 7:00 PM.
This package depends on Carbon.
This is how to get Hijri/Gregorian DateTime.
1$dt = Carbon::now();2 3echo $dt->isoFormat('LLLL'); // Tuesday, May 25, 2021 7:00 PM 4echo $dt->toHijri()->isoFormat('LLLL'); // Tuesday, Shawwal 13, 1442 7:00 PM5 6echo $dt->format('r'); // Tue, 25 May 2021 07:00:00 +0000 7echo $dt->toHijri()->format('r'); // Tue, 13 Shawwal 1442 07:00:00 +0000
Using Hijri with multiple languages through 2 ways [ global, inline ] .
You can use a specific language as you want, just you need to change ar to the language that you need.
1$dt = Carbon::now();2 3// Global4Carbon::setLocale('ar'); 5echo $dt->toHijri()->isoFormat('LLLL'); // الثلاثاء 13 شوّال 1442 07:006 7// Inline8echo $dt->toHijri()->locale('ar')->isoFormat('LLLL');