use OpenCafe\Datium; use OpenCafe\Tools\Leap; return array('convert_to' => function ($date_time) { $config = (include 'Jalali.php'); $date_time = Datium::create($date_time)->to('jalali')->object(); $year = $date_time->format('Y'); $month = $date_time->format('n'); $day = $date_time->format('d'); $temp_day = 0; for ($i = 1; $i < $month; $i++) { $temp_day += $config['month_days_number'][$i]; } $temp_day += $day; $leap = new Leap($year); if ($leap->get() && $month > 11) { $temp_day++; } $_year = (($year - 1) * 365.2422 + $temp_day - 119) / 354.367 + 1; $_year = explode('.', $_year); $year = $_year[0]; $_month = $_year[1]; $var_temp = '0.0'; for ($i = strlen($_month); $i > 2; $i--) { $var_temp .= '0'; } $var_temp .= '1'; $_month = $_month * $var_temp; $_month = $_month * 12 + 1; $_month = explode('.', $_month); $month = $_month[0];
<?php use OpenCafe\Datium; use OpenCafe\Tools\Leap; return array('timezone' => 'Asia/Tehran', 'language' => 'fa', 'events' => array(), 'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), 'am_time' => 'AM', 'pm_time' => 'PM', 'end_of_days' => array('th', 'st', 'nd', 'rd'), 'convert_to' => function ($date_time) { $config = (include 'Gregorian.php'); $year = $date_time->format('Y'); $month = $date_time->format('m'); $day = $date_time->format('d'); $temp_day = 0; for ($i = 1; $i < $month; $i++) { $temp_day += $config['month_days_number'][$i]; } $temp_day += $day; $leap = new Leap($year); if ($leap->get() && $month > 2) { $temp_day++; } if ($temp_day <= 79) { if (($year - 1) % 4 == 0) { $temp_day = $temp_day + 11; } else { $temp_day = $temp_day + 10; } $year = $year - 622; if ($temp_day % 30 == 0) { $month = $temp_day / 30 + 9; $day = 30; } else { $month = $temp_day / 30 + 10; $day = $temp_day % 30;