php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45534 Wrong date returned for function jewishtojd
Submitted: 2008-07-16 21:36 UTC Modified: 2008-07-17 12:56 UTC
From: georgew at rationalcomputing dot ca Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.6 OS: Windows Vista
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: georgew at rationalcomputing dot ca
New email:
PHP Version: OS:

 

 [2008-07-16 21:36 UTC] georgew at rationalcomputing dot ca
Description:
------------
The Jewish date for Yom Kippur and Rosh Hashanah are consistently 1 day off.  I attempted to reproduce these days for the next 10 years and converting them to Gregorian dates and below are my results.

Please note I am using 1,1,5769 to 1,1,5778 for Rosh Hashanah (the 2nd day) and 1,10,5769 to 1,10,5778 for Yom Kippur as shown in the reproduce code section below.

Also, I have done it for the other Jewish holidays and although I have not thoroughly tested there it seems correct for those. 


Reproduce code:
---------------
function heb_greg($hebmon,$hebday,$hebyear)
{
    return  jdtogregorian(jewishtojd($hebmon,$hebday,$hebyear));
}
echo (heb_greg(1,1,5769)),"<br>" ;
echo (heb_greg(1,10,5769)),"<br>" ;
echo (heb_greg(1,1,5770)),"<br>" ;
echo (heb_greg(1,10,5770)),"<br>" ;
echo (heb_greg(1,1,5771)),"<br>" ;
echo (heb_greg(1,10,5771)),"<br>" ;
echo (heb_greg(1,1,5772)),"<br>" ;
echo (heb_greg(1,10,5772)),"<br>" ;
echo (heb_greg(1,1,5773)),"<br>" ;
echo (heb_greg(1,10,5773)),"<br>" ;
echo (heb_greg(1,1,5774)),"<br>" ;
echo (heb_greg(1,10,5774)),"<br>" ;
echo (heb_greg(1,1,5775)),"<br>" ;
echo (heb_greg(1,10,5775)),"<br>" ;
echo (heb_greg(1,1,5776)),"<br>" ;
echo (heb_greg(1,10,5776)),"<br>" ;
echo (heb_greg(1,1,5777)),"<br>" ;
echo (heb_greg(1,10,5777)),"<br>" ;
echo (heb_greg(1,1,5778)),"<br>" ;
echo (heb_greg(1,10,5778)),"<br>" ;


Expected result:
----------------
The expected result is:
9/30/2008
10/8/2008
9/19/2009
9/27/2009
9/9/2010
9/17/2010
9/29/2011
10/7/2011
9/17/2012
9/25/2012
9/5/2013
9/13/2013
9/25/2014
10/3/2014
9/14/2015
9/22/2015
10/3/2016
10/11/2016
9/21/2017
9/29/2017



Actual result:
--------------
The actual result is
9/30/2008
10/9/2008
9/19/2009
9/28/2009
9/9/2010
9/18/2010
9/29/2011
10/8/2011
9/17/2012
9/26/2012
9/5/2013
9/14/2013
9/25/2014
10/4/2014
9/14/2015
9/23/2015
10/3/2016
10/12/2016
9/21/2017
9/30/2017



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-17 12:56 UTC] georgew at rationalcomputing dot ca
The issue was a misunderstanding of the 1st and 2nd days of RH.  Sorry for the alert
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 10 06:01:31 2024 UTC