cal_from_jd


php apg

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



<?php

arr cal_from_jd 
( int $julian_day , int $calendar )


where,

$julian_day = A Julian Day Number, (JDN)

$calendar = A calendar to be converted
                   
( SEE the below TABLE )

?>

 $julian_dayd 


A Julian Day Number, (JDN) .



 $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 !



 RETURNED ELEMENTS 

ARRAY INDEX MEANING
[date] DATE (month/day/year)
[month] Number of the month
[day] Number of the day
[year] Number of the year
[dow] Number of the day in the week
[abbrevdayname] Abbreviation for the name of the day of the week
[dayname] Name of the day of the week
[abbrevmonth] Abbreviation for month name
[monthname] Name of the month
ed48


  1 EXERCISE   

<?php 

$tsnow 
= microtime(1);

$unx2jd = unixtojd($tsnow);

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


foreach(
$cals as $cl => $c) 
{ 
    echo 
$cl . ':<br>';

    echo 
'Date = ' . cal_from_jd($unx2jd, $c)['date'] . '<br>';
    echo 
'Month Number = ' . cal_from_jd($unx2jd, $c)['month'] . '<br>';
    echo 
'Day Number = ' . cal_from_jd($unx2jd, $c)['day'] . '<br>';
    echo 
'Year Number = ' . cal_from_jd($unx2jd, $c)['year'] . '<br>';
    echo 
'Day of Week Number = ' . cal_from_jd($unx2jd, $c)['dow'] . '<br>';
    echo 
'Abbrev Day Name = ' . cal_from_jd($unx2jd, $c)['abbrevdayname'] . '<br>';
    echo 
'Full Day Name = ' . cal_from_jd($unx2jd, $c)['dayname'] . '<br>';
    echo 
'Abbrev Month Name = ' . cal_from_jd($unx2jd, $c)['abbrevmonth'] . '<br>';
    echo 
'Full Month Name = ' . cal_from_jd($unx2jd, $c)['monthname'];
    
    echo 
'<br><br>'; 
} 

?>