You are here

function cmfcCalendarV1Arabic::fromGregorian in Calendar Systems 7.3

Same name and namespace in other branches
  1. 8 calendar/v1/calendarSystems/arabic.class.inc.php \cmfcCalendarV1Arabic::fromGregorian()
  2. 8.2 calendar/v1/calendarSystems/arabic.class.inc.php \cmfcCalendarV1Arabic::fromGregorian()
  3. 6.3 calendar/v1/calendarSystems/arabic.class.inc.php \cmfcCalendarV1Arabic::fromGregorian()
  4. 6 calendar/v1/calendarSystems/arabic.class.inc.php \cmfcCalendarV1Arabic::fromGregorian()
  5. 7 calendar/v1/calendarSystems/arabic.class.inc.php \cmfcCalendarV1Arabic::fromGregorian()
  6. 7.2 calendar/v1/calendarSystems/arabic.class.inc.php \cmfcCalendarV1Arabic::fromGregorian()

* Islamic Calendar *

Parameters

$g_y: * @param $g_m * @param $g_d * @return unknown_type

4 calls to cmfcCalendarV1Arabic::fromGregorian()
cmfcCalendarV1Arabic::date in calendar/v1/calendarSystems/arabic.class.inc.php
Implementation of PHP date function This is the simplified version by Sina Salek
cmfcCalendarV1Arabic::monthStartDay in calendar/v1/calendarSystems/arabic.class.inc.php
Find num of Day Begining Of Month ( 0 for Sat & 6 for Sun)
cmfcCalendarV1Arabic::monthTotalDays in calendar/v1/calendarSystems/arabic.class.inc.php
* @author * Find Number Of Days In This Month
cmfcCalendarV1Arabic::timestampToInfoArray in calendar/v1/calendarSystems/arabic.class.inc.php

File

calendar/v1/calendarSystems/arabic.class.inc.php, line 453

Class

cmfcCalendarV1Arabic

Code

function fromGregorian($g_y, $g_m, $g_d) {
  $y = $g_y;
  $m = $g_m;
  $d = $g_d;
  if ($y > 1582 || $y == 1582 && $m > 10 || $y == 1582 && $m == 10 && $d > 14) {
    $jd = (int) (1461 * ($y + 4800 + (int) (($m - 14) / 12)) / 4) + (int) (367 * ($m - 2 - 12 * (int) (($m - 14) / 12)) / 12) - (int) (3 * (int) (($y + 4900 + (int) (($m - 14) / 12)) / 100) / 4) + $d - 32075;
  }
  else {
    $jd = 367 * $y - (int) (7 * ($y + 5001 + (int) (($m - 9) / 7)) / 4) + (int) (275 * $m / 9) + $d + 1729777;
  }
  $julianday = $jd;
  $l = $jd - 1948440 + 10632;
  $n = (int) (($l - 1) / 10631);
  $l = $l - 10631 * $n + 354;
  $j = (int) ((10985 - $l) / 5316) * (int) (50 * $l / 17719) + (int) ($l / 5670) * (int) (43 * $l / 15238);
  $l = $l - (int) ((30 - $j) / 15) * (int) (17719 * $j / 50) - (int) ($j / 16) * (int) (15238 * $j / 43) + 29;
  $m = (int) (24 * $l / 709);
  $d = $l - (int) (709 * $m / 24);
  $y = 30 * $n + $j - 30;
  return array(
    $y,
    $m,
    $d,
  );
}