function DatexHejri::_toGregorian in Datex 7.2
Islamic Calendar
Parameters
$i_y:
$i_m:
$i_d:
Return value
unknown_type
File
- datex_api/
DatexHejri.inc, line 158
Class
- DatexHejri
- @author Sina Salek
Code
function _toGregorian($i_y, $i_m, $i_d) {
//$jd=$this->islamic_to_jd($i_y, $i_m, $i_d);
//list($gy, $gm, $gd)=JDToGregorian($jd);
$y = $i_y;
$m = $i_m;
$d = $i_d;
$jd = (int) ((11 * $y + 3) / 30) + 354 * $y + 30 * $m - (int) (($m - 1) / 2) + $d + 1948440 - 385;
//$this->julianday = $jd;
if ($jd > 2299160) {
$l = $jd + 68569;
$n = (int) (4 * $l / 146097);
$l = $l - (int) ((146097 * $n + 3) / 4);
$i = (int) (4000 * ($l + 1) / 1461001);
$l = $l - (int) (1461 * $i / 4) + 31;
$j = (int) (80 * $l / 2447);
$d = $l - (int) (2447 * $j / 80);
$l = (int) ($j / 11);
$m = $j + 2 - 12 * $l;
$y = 100 * ($n - 49) + $i + $l;
}
else {
$j = $jd + 1402;
$k = (int) (($j - 1) / 1461);
$l = $j - 1461 * $k;
$n = (int) (($l - 1) / 365) - (int) ($l / 1461);
$i = $l - 365 * $n + 30;
$j = (int) (80 * $i / 2447);
$d = $i - (int) (2447 * $j / 80);
$i = (int) ($j / 11);
$m = $j + 2 - 12 * $i;
$y = 4 * $k + $n + $i - 4716;
}
return array(
$y,
$m,
$d,
);
}