note 96673 added to function.jdtofrench
| From: | pieterc dot depraetere at ugent dot be | Date: | Wed, 10 Mar 2010 22:04:46 +0000 |
| Subject: | note 96673 added to function.jdtofrench | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166889@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 <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;
}
?>
----
Server IP: 217.71.118.186
Probable Submitter: 94.110.22.117
----
Manual Page -- http://www.php.net/manual/en/function.jdtofrench.php
Edit -- https://master.php.net/note/edit/96673
Del: integrated -- https://master.php.net/note/delete/96673/integrated
Del: useless -- https://master.php.net/note/delete/96673/useless
Del: bad code -- https://master.php.net/note/delete/96673/bad+code
Del: spam -- https://master.php.net/note/delete/96673/spam
Del: non-english -- https://master.php.net/note/delete/96673/non-english
Del: in docs -- https://master.php.net/note/delete/96673/in+docs
Del: other reasons-- https://master.php.net/note/delete/96673
Reject -- https://master.php.net/note/reject/96673
Search -- https://master.php.net/manage/user-notes.php