From:             [EMAIL PROTECTED]
Operating system: linux/windows
PHP version:      4.1.2
PHP Bug Type:     *Calendar problems
Bug description:  function juliantojd and reverse jdtojulian wrong output

in function juliantojd (and reverse jdtojulian) the wrong calendar rules
are implemented.

the output of function for the date 1/1/1985 is 2446080 but
the correct julian date is 2446067 (for example).

below the rules to convert a julian date into jd as a php-script:

<?php
   $a=$year;
   $m=$month;
   $t=$day;
   $j=$a;
   IF ($a<0){$j=$j+1;}
   IF ($m<3){
      $m=$m+12;
      $j=$j-1;
   }
   $juldat=0;
   IF (($a+$m/100+$tag/10000)>1582.1005){
     $juldat= floor($j/100);
     $juldat=2-$juldat+ floor($juldat/4);
   }
   IF ($a<=0){
     $juldat=- floor(.75-365.25*$j)+ floor(30.6001*($m+1))+$t+1720995;
   }
   ELSE{
     $juldat=$juldat+ floor(365.25*$j)+ floor(30.6001*($m+1))+$t+1720995;
   }
?>
-- 
Edit bug report at http://bugs.php.net/?id=17016&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=17016&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=17016&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=17016&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=17016&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17016&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=17016&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=17016&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=17016&r=submittedtwice
register_globals:    http://bugs.php.net/fix.php?id=17016&r=globals

Reply via email to