note 35774 added to function.jdtogregorian

From: Date: Sun, 14 Sep 2003 12:05:12 +0000
Subject: note 35774 added to function.jdtogregorian
Groups: php.notes 
Request: Send a blank email to php-notes+get-56469@lists.php.net to get a copy of this message
I have made a slight modification to treebe's jd to greg function, this one will transform a unix timestamp to Gregorian day/month/year format... function unix_to_greg($unix_timestamp) { $julian = floor(((($unix_timestamp / "60") / "60") / "24") + "2440588"); $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+35774 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35774&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35774&report=yes

« previous php.notes (#56469) next »