PHP | frenchtojd() Function

The frenchtojd() function is a built-in function which converts a French date to a Julian Day Count. The function accepts three parameters in format $month / $day / $year, which represents the date in French republican calendar and converts it to a Julian Day count.

Syntax:

frenchtojd( $month, $day, $year) 

Parameters: The function accepts three mandatory parameters as shown above and described below:



  1. $month – This parameter specifies the month number in French calendar. The month number is in range 1-13 inclusive. If a month number in excess of 12 or less than 0 is passed, the Julian day is returned as 0.
  2. $day – This parameter specifies the day in French calendar. The day number is in range 1-30 inclusive. If a day number in excess of 31 or less than 0 is passed, the Julian day is returned as 0. Leap years are not taken into consideration
  3. $year – This parameter specifies the year in French calendar. The year number is in range 1-14 inclusive. If a year number in excess of 14 or less than 1 is passed, the Julian day is returned as 0. Leap years are not taken into consideration

Return Value: The function returns the French date converted to a Julian Day count.

Examples:

Input : $month=3, $day=11, $year=12
Output : 2379928 

Input : $month=4, $day=8, $year=13
Output : 2380320

Below program illustrate the frenchtojd() function.

Program 1: The program below demonstrates the use of frenchtojd() function.

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP program to demonstrate the
// use of frenchtojd() function 
  
// converts date to julian integer 
$jd=frenchtojd(4, 8, 13);
  
// prints the julian day integer
echo ($jd);
?>

chevron_right


Output:

 2380320

Program 2: The program below demonstrates when day and month out of range.

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP program to demonstrate the
// use of frenchtojd() function 
  
// converts date to julian integer 
// month is out of range
$jd=frenchtojd(22, 8, 11);
  
// prints the julian day integer
echo ($jd), "\n"
  
  
// day is out of range
$jd=frenchtojd(4, 32, 11);
echo ($jd); 
?>

chevron_right


Output:

0
0

Reference:
http://php.net/manual/en/function.frenchtojd.php



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.