hekmatinasser / verta

تبدیل تاریخ میلادی به شمسی برای لاراول و کار با تاریخ جلالی و اعتبارسنجی تاریخ
https://hekmatinasser.github.io/verta/
MIT License
595 stars 77 forks source link

how to convert persian date string to gregorian #98

Closed bobper closed 3 years ago

bobper commented 3 years ago

This is input of "۱۴۰۰-۰۲-۲۱" babakhani js date picker how to convert this string to gregorian date for now we must do this step $start_time = "۱۴۰۰-۰۲-۲۱"; $arr = explode('-' , Verta::faToEnNumbers($start_time)); $gregorianArray = Verta::getGregorian((int)$arr[0] ,(int) $arr[1] , (int)$arr[2]) ; $gregorianDate = implode('-' ,$gregorianArray); it's better this be a function thanks

hekmatinasser commented 3 years ago

you can use Verta::parse("۱۴۰۰-۰۲-۲۱")->formatGregorian('Y-m-d);