Closed palvaneh closed 8 years ago
There is no library such as DateTime or Carbon for working with Jalali time and i have to work with gregorian date . Every operations are work on a DateTime instance in jDate class and in the format
method i convert it into jalali date.
my solution
$mydate = Carbon::createFromFormat('Y-m-d', $sqlDate);
$arr = jDateTime::toJalali($mydate->year, $mydate->month, $mydate->day);
$arr = jDateTime::toGregorian(++$arr[0], $arr[1], $arr[2]);
$newSqlDate = Carbon::createFromDate($arr[0], $arr[1], $arr[2])->toDateString();
$date = jDate::forge('2012-10-12')->reforge('next year')->format('Y-m-d');
reforge function works on Gregorian date and ignores Jalali leap years.Specially, I want to add 1 year to a SQL date column without losing leap year computation. (In my program SQL date columns are Gregorian, but users should work with Jalali date formats.)
thanks