/*
This function computes the difference in days between the old
Julian calendar and the modern Gregorian calendar in the context
of DiffDays = (J − G).
This value is applied to the Julian Day Number according to the
Julian calendar to obtain the JD Number for the same date on the
modern Gregorian calendar.
If we changed to the Gregorian calendar in the given year and month,
then this is the number of days we would have to apply to bring the
Julian calendar into sync with the Gregorian calendar.
In AD 1582-Oct, it amounted to −10 days.
Today, it amounts to −13 days.
This computation only involves the sYear/Month values.
The day of the month is not needed in this case.
This difference value can be either negative or positive, depending
on the sYear/Month arguments.
ERRORS:
Returns false if arguments are non-numeric.
NO DEPENDENCIES
*/
function J_G_Cal_Diff ($sY, $m)
{
$Y = trim($sY); if (!Is_Numeric($sY)) {return FALSE;}
$m = trim($m); if (!Is_Numeric($m)) {return FALSE;}
$w = floor(((($Y < 0)? $Y+1 : $Y) - floor((14-$m)/12)) / 100);
$DaysDiff = (floor($w/4) - $w + 2);
return $DaysDiff;
}