Click to rate this post!
[Total: 2 Average: 5]
1. Install Easy Jalali Library via Composer:
composer require majidcode/easy-jalali
Note: you can use it in your Laravel project.
2. Add your DateTime to EasyJalali
- If it’s Georgian use
EasyJalali::fromGeorgian('2022-11-02', 'Y-m-d');
to create your date in EasyJalali. - If it’s Jalali use
EasyJalali::fromJalali('1399-05-21', 'Y-m-d');
to create your date in EasyJalali. - Also, you can use carbon to create date in EasyJalali:
EasyJalali::fromCarbon(Carbon::now());
3. Convert to your format
- Use
toJalali()
ortoGeorgian()
to convert your date.
4. Get your result in your favourite format.
- You can use
toFormat('Y/m/d');
to get your result.
Example of use in the Laravel 8.0:
Click to rate this post!
[Total: 2 Average: 5]