Bug #75064 [Opn->Ver]: There is no clear description of function jdtogregorian

From: Date: Fri, 11 Aug 2017 15:47:54 +0000
Subject: Bug #75064 [Opn->Ver]: There is no clear description of function jdtogregorian
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210614@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75064&edit=1 ID: 75064 Updated by: requinix@php.net Reported by: daniel at ohr dot edu Summary: There is no clear description of function jdtogregorian -Status: Open +Status: Verified Type: Bug -Package: Documentation problem +Package: *Calendar problems Operating System: Mac OS X Sierra PHP Version: 7.2.0beta2 Block user comment: N Private report: N New Comment: jdtogregorian uses the proleptic Gregorian calendar. JD 0 was Nov 24. 1099114 ≈ 365.2425 * 3009 + 100 ≈ 1099014 + 100 therefore JD 1099114 = Nov 23 -1705 + 100 days = Mar 3 -1704 You can see the code in ext/calendar/gregor.c. Elsewhere I've said that the docs for most jd* functions looked fine. Maybe that's not the case. Even though the introduction http://php.net/manual/en/intro.calendar.php gives a couple links, perhaps a short note/lnik with each of the Julian day functions is in order too. Previous Comments: ------------------------------------------------------------------------ [2017-08-11 14:51:21] daniel at ohr dot edu Description: ------------ --- From manual page: http://www.php.net/function.jdtogregorian --- jdgregorian works but it is not clear how dates are handled JD 1099114 Returns 3/3/-1704 which would be interpreted as 3 Mar 1704 B.C.E. Gregorian (0:00 am) Meeus converts and gets MEU: 3/18/-1703 - i.e. 18 Mar 1703 B.C.E 1721425 returns 12/31/-1 1721426 returns 1/1/1 which shows that there is no year 0 Meeus includes year 0 for astronomers There needs to be clearer documentation about what formula is being used, and what is the starting point for the conversion (25 Nov -4712 Gregorian, JD 1) Because at the moment JD 1 = 25 Nov -4714 which is not correct according to Meeus. Test script: --------------- function jd_to_greg_meeus($J) { $Z = intval($J+0.5); $F = ($J+0.5)-$Z; if ($Z < 2299161) {$A = $Z;} if ($Z >= 2299161) { $alpha = floor(($Z-1867216.25)/36524.25); $A = $Z + 1 + $alpha - floor($alpha/4); } $B = $A + 1524; $C = floor( ($B-122.1)/365.25); $D = floor( 365.25*$C ); $E = floor( ($B-$D)/30.6001 ); $day = floor($B - $D - floor(30.6001*$E)); if ($E < 13.5) { $month = $E - 1;} if ($E > 13.5) { $month = $E - 13;} if ($month > 2.5) { $year = $C - 4716; } if ($month < 2.5) { $year = $C - 4715; } return "$month/$day/$year"; } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75064&edit=1

« previous php.bugs (#210614) next »