jdtofrench
string jdtofrench(int JD)
Converts a Julian day count to a French Republican Calendar date.
Returns:
French Republican Calendar date; 0/0/0 if an invalid Julian day count is specified
Description:
jdtofrench() converts a Julian day count to a French Republican Calendar date string. The returned date string is formatted as MM/DD/YY.
Valid Julian day counts for this function range from 2375840 to 2380952. If a count outside this range is specified, the function returns 0/0/0.
Version:
3+, 4+
See also:
To convert a French Republican Calendar date to a Julian day count:
frenchtojd()
To get a Julian day count from another calendar system, see the various *tojd functions.
Example:
Convert a Gregorian date to a textual French Republican Calendar date
<?php
function gregorian_to_french ($year, $month, $date) {
// Define start and end dates for the French Republican Calendar
$frc_start = gregoriantojd (9, 22, 1792);
$frc_end = gregoriantojd (9, 22, 1806);
// Convert date to a Julian day count
$date_to_convert = gregoriantojd ($month, $date, $year);
// Ensure that the date to be converted is within the start and end dates
if ($date_to_convert < $frc_start || $date_to_convert > $frc_end)
return FALSE;
// Define month names
$month_names = array (
1 => 'Germinal', 2 => 'Floréal', 3 => 'Prairial',
4 => 'Messidor',
5 => 'Thermidor', 6 => 'Fructidor', 7 => 'Vendémiaire',
8 => 'Brumaire',
9 => 'Frimaire', 10 => 'Nivôse', 11 => 'Pluviôse',
12 => 'Ventôse',
13 => 'Complémentaire / Festival de Sans-culottides'
);
$frc_date = jdtofrench ($date_to_convert);
list ($month, $date, $year) = explode ('/', $frc_date);
return "$month_names[$month] $date, $year";
}
echo gregorian_to_french (1799, 9, 22);
?>
|