note 32561 added to function.jdtogregorian

From: Date: Sat, 31 May 2003 10:01:59 +0000
Subject: note 32561 added to function.jdtogregorian
Groups: php.notes 
Request: Send a blank email to php-notes+get-49479@lists.php.net to get a copy of this message
Julian to Gregorian date change. If you do not have the calendar extensions loaded this is little function works realy well. function jd_to_greg($julian) { $julian = $julian - 1721119; $calc1 = 4 * $julian - 1; $year = floor($calc1 / 146097); $julian = floor($calc1 - 146097 * $year); $day = floor($julian / 4); $calc2 = 4 * $day + 3; $julian = floor($calc2 / 1461); $day = $calc2 - 1461 * $julian; $day = floor(($day + 4) / 4); $calc3 = 5 * $day - 3; $month = floor($calc3 / 153); $day = $calc3 - 153 * $month; $day = floor(($day + 5) / 5); $year = 100 * $year + $julian; if ($month < 10) { $month = $month + 3; } else { $month = $month - 9; $year = $year + 1; } return "$day.$month.$year"; } ---- Manual Page -- http://www.php.net/manual/en/function.jdtogregorian.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32561 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32561&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32561&report=yes

« previous php.notes (#49479) next »