cal_to_jd


php apg

CONVERTS from a supported calendar to a Julian Day Number, (JDN).



<?php

int cal_to_jd 
( int $calendar , int $month , int $day , int $year )


where,

$calendar = A calendar to convert from
                   
( SEE the below TABLE )
                   
$month = The month number in the selected calendar

$day 
= The day number in the selected calendar

$year 
= The year number in the selected calendar

?>

 $calendar 

CONSTANT NAME VALUES CALENDAR NAME
CAL_GREGORIAN 0 or NULL Gregorian
CAL_JULIAN 1 Julian
CAL_JEWISH 2 Jewish
CAL_FRENCH 3 French Revolutionary
ed48

What you must know about calendars:
Julian Calendar !   French Republican Calendar !  
Hebrew Calendar !   Gregorian Calendar !



 $month 


The month number in the selected calendar.



 $day 


The day number in the selected calendar.



 $year 


The year number in the selected calendar.



  1 EXERCISE   

<?php

$im 
= idate('m');
$id = idate('d');
$iy = idate('Y');

$cals = [ 'CAL_GREGORIAN' => CAL_GREGORIAN, 
                     
'CAL_JULIAN' => CAL_JULIAN, 
                    
'CAL_JEWISH' => CAL_JEWISH, 
                    
'CAL_FRENCH' => CAL_FRENCH ];


foreach(
$cals as $cl => $c)
{
    echo 
$cl . ':<br>' . cal_to_jd($c, $im, $id, $iy) . '<br><br>';
}

?>