note 96673 modified in function.jdtofrench by danbrown

From: Date: Wed, 10 Mar 2010 22:11:28 +0000
Subject: note 96673 modified in function.jdtofrench by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-166890@lists.php.net to get a copy of this message
If you want to convert a date later than September 22nd 1806, you could use this function. It's a bit crude and due to the fact the original function terminates in the middle of 1806, it uses 1805 as it's 'terminus post quem'. <?php function extended_jdtofrench ($juliandate) { if ($juliandate > 2380945) { // jdtofrench () only accepts dates until september 1806 $gregorian_date = jdtogregorian ($juliandate); $temp = explode ('/', $gregorian_date); $year = $temp[2]; $juliandate = gregoriantojd ($temp[0], $temp[1], 1805); $republican_date = jdtofrench ($juliandate); $republican_date = explode ('/', $republican_date); $diff = $year - 1805; $republican_date[2] = $republican_date[2] + $diff; } else { $republican_date = jdtofrench ($juliandate); } return $republican_date; } ?> --was-- If you want to convert a date later than September 22nd 1806, you could use this function. It's a bit crude and due to the fact the original function terminates in the middle of 1806, it uses 1805 as it's <i>terminus post quem</i>. <?php function extended_jdtofrench ($juliandate) { if ($juliandate > 2380945) { // jdtofrench () only accepts dates until september 1806 $gregorian_date = jdtogregorian ($juliandate); $temp = explode ('/', $gregorian_date); $year = $temp[2]; $juliandate = gregoriantojd ($temp[0], $temp[1], 1805); $republican_date = jdtofrench ($juliandate); $republican_date = explode ('/', $republican_date); $diff = $year - 1805; $republican_date[2] = $republican_date[2] + $diff; } else { $republican_date = jdtofrench ($juliandate); } return $republican_date; } ?> http://php.net/manual/en/function.jdtofrench.php

« previous php.notes (#166890) next »