PHP Function Reference

PHP frenchtojd() Function



The PHP frenchtojd() function converts a date from the French Republican Calendar to a Julian Day Count.

The French Republican Calendar is a calendar proposed during the French Revolution, and used by the French government for about twelve years from late 1793. This function only convert dates in years 1 through 14 (Gregorian dates 22 September 1792 - 22 September 1806).

Syntax

frenchtojd(month, day, year)

Parameters

month Required. Specify the month as a number from 1 (for Vendémiaire) to 13 (for the period of 5-6 days at the end of each year).
day Required. Specify the day as a number from 1 to 30.
year Required. Specify year as a number between 1 and 14.

Return Value

Returns the Julian Day count for the given date from the French Republican Calendar. Dates outside the valid range return 0.

Exceptions

NA.

Example:

The example below shows the usage of frenchtojd() function.

<?php
//converting a French Republican date
//to Julian integer 
$jd = frenchtojd(10, 2, 12);
  
//displaying the Julian day integer 
echo "The Julian day integer is: $jd \n";
  
//converting the Julian day integer 
//to French Republican date
$date = jdtofrench($jd);
  
//displaying the French Republican date
echo "The French Republican date is: $date \n"; 
?>

The output of the above code will be:

The Julian day integer is: 2380129 
The French Republican date is: 10/2/12 

Example: Overflow behavior

Consider one more example to see the overflow behavior of this function.

<?php
//converting an invalid French Republican 
//date to Julian integer 
$jd = frenchtojd(10, 2, 18);
  
//prints 0 as year is out of range 
echo "The Julian day integer is: $jd \n";
  
//converting the Julian day integer 
//to French Republican date
$date = jdtofrench($jd);
  
//prints 0/0/0 as French Republican 
//year is out of range
echo "The French Republican date is: $date \n"; 
?>

The output of the above code will be:

The Julian day integer is: 0 
The French Republican date is: 0/0/0 

❮ PHP Calendar Reference