|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17016 function juliantojd and reverse jdtojulian wrong output
Submitted: 2002-05-05 10:47 UTC Modified: 2002-05-05 11:28 UTC
From: nchesberg at t-online dot de Assigned:
Status: Not a bug Package: Calendar related
PHP Version: 4.1.2 OS: linux/windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: nchesberg at t-online dot de
New email:
PHP Version: OS:


 [2002-05-05 10:47 UTC] nchesberg at t-online dot de
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:

   IF ($a<0){$j=$j+1;}
   IF ($m<3){
   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;
     $juldat=$juldat+ floor(365.25*$j)+ floor(30.6001*($m+1))+$t+1720995;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-05 11:28 UTC]
no, that would be gregoriantojd(). we're operating under the gregorian calendar now.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 08:01:31 2024 UTC