#25288 [NEW]: Wrong JulianDayCount
| From: | josep dot gorro at trendcomms dot es | Date: | Thu, 28 Aug 2003 11:25:20 +0000 |
| Subject: | #25288 [NEW]: Wrong JulianDayCount | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-46832@lists.php.net to get a copy of this message | ||
From: josep dot gorro at trendcomms dot es
Operating system: WinNT
PHP version: 4.3.1
PHP Bug Type: Calendar related
Bug description: Wrong JulianDayCount
Description:
------------
I'm generating a function to calculate a date in Julian day count to be
used in excel spreadsheet. Always I obtain a 2 days difference. Is this a
bug?
Reproduce code:
---------------
<?php
// This is the date that I would to convert
$jd1 = GregorianToJD (8,28,2003);
print "$jd1\n";
$gregorian1 = JDToGregorian ($jd1);
print "$gregorian1\n";
// This is the initial excel's date counter
$jd2 = GregorianToJD (1,1,1900);
print "$jd2\n";
$gregorian2 = JDToGregorian ($jd2);
print "$gregorian2\n";
// This is the REAL (not bogus) day counter
$total=$jd1 - $jd2 + 2;
print "Excel value: ".$total;
?>
Expected result:
----------------
Without the correction ($total=$jd1 - $jd2;) the result is:
2452880 8/28/2003
2415021 1/1/1900
Real counter: 37859
Whit the correction ($total=$jd1 - $jd2 + 2;) the result is:
2452880 8/28/2003
2415021 1/1/1900
Real counter: 37861
First one isn't correct, second one is fine.
--
Edit bug report at http://bugs.php.net/?id=25288&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25288&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25288&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25288&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25288&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25288&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25288&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25288&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25288&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25288&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25288&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25288&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25288&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25288&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25288&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25288&r=gnused