Verta allows seamless conversion between the Gregorian and Jalali (Solar Hijri) calendars.
Gregorian to Jalali
Instantiate Verta with a Gregorian date string to get a Jalali instance.
Jalali to Gregorian
Use Verta::parse() with a Jalali date string, then call ->datetime() to retrieve the Gregorian equivalent.
Carbon to Jalali
If you are using the Carbon library, you can call ->toJalali() on a Carbon instance.
Jalali to Carbon
Call ->toCarbon() on a Verta instance to convert it back to a Carbon instance.
// Gregorian to Jalali
echo verta('2022-08-15'); // 1401-05-24 00:00:00
// Jalali to Gregorian
echo Verta::parse('1401-05-24 14:12:32')->datetime(); // 2022-08-15 00:00:00
// Carbon to Jalali
echo now()->toJalali(); // 1401-05-24 00:00:00
// Jalali to Carbon
echo verta()->toCarbon(); // 2022-08-15 00:00:00