PHP jdtofrench() Function

Beginner
5 min read
Updated: Nov 2026
3 examples
Calendar

Definition

In PHP, jdtofrench() converts a Julian Day number into a French Republican date string.

This is the reverse of frenchtojd(). The French calendar was only used for a short time, so PHP supports Julian Days from September 22, 1792 to September 22, 1806. Dates outside that range return the text 0/0/0.

Syntax

Call jdtofrench() with the values you need. Start with this line.

PHP
$date = jdtofrench($jd);
CallWhat it does
jdtofrench(2375840)Returns 1/1/1, the first day of the calendar.
jdtofrench(2378444)Returns 2/18/8, which is 18 Brumaire in year VIII.
jdtofrench(gregoriantojd(1, 1, 2024))Returns 0/0/0 because 2024 is outside the supported range.

The result is a string like 2/18/8, in month/day/year order, and it has no leading zeros. Use explode('/') to split it into parts. Use jdmonthname() with CAL_MONTH_FRENCH to get the month name.

Library declarations
PHP
jdtofrench(int $julian_day): string

Parameters

ParameterDescription
julian_dayRequired. The Julian Day number to convert. Only 2375840 to 2380952 give a real French date.

Return Value

Return ValueDescription
stringA date as month/day/year text, such as 1/1/1. It returns 0/0/0 if the Julian Day is outside the supported range.

PHP Examples

Example 1 — Convert to French Dates

Convert Julian Days from the French Revolution era into French Republican dates.

PHP
<?php
echo jdtofrench(2375840), PHP_EOL;
echo jdtofrench(2376205), PHP_EOL;
echo jdtofrench(2378444), PHP_EOL;
echo jdtofrench(gregoriantojd(9, 22, 1793)), PHP_EOL;

How It Works

  1. 2375840 is the first valid day, so it returns 1/1/1.
  2. 365 days later (2376205) is the start of year 2, which is 1/1/2.
  3. The Julian Day 2378444 is 18 Brumaire (month 2) of year 8, returned as 2/18/8.
  4. September 22, 1793 in the Gregorian calendar is also the start of year 2.

Example 2 — The Edges of the Range

Only a small range of Julian Days is supported. Check the first valid day, the last valid day, and a day just outside the range.

PHP
<?php
echo jdtofrench(2375839), PHP_EOL;
echo jdtofrench(2375840), PHP_EOL;
echo jdtofrench(2380952), PHP_EOL;
echo jdtofrench(2380953), PHP_EOL;

How It Works

  1. The day before the calendar began (2375839) is not supported, so you get 0/0/0.
  2. 2375840 is the first valid day, 1/1/1.
  3. 2380952 is the last valid day, the 5th extra day (month 13) of year 14.
  4. The very next day (2380953) is outside the range, so you get 0/0/0 again.

Example 3 — Split the Result into Parts

Use explode() to split the text, then ask jdmonthname() for the French month name.

PHP
<?php
$jd = 2378444;

[$month, $day, $year] = explode('/', jdtofrench($jd));

echo 'Year: ', $year, PHP_EOL;
echo 'Month: ', $month, ' (', jdmonthname($jd, CAL_MONTH_FRENCH), ')', PHP_EOL;
echo 'Day: ', $day, PHP_EOL;
echo 'Gregorian: ', jdtogregorian($jd), PHP_EOL;

How It Works

  1. jdtofrench() returns the text 2/18/8.
  2. explode('/') splits it into month, day and year, and the list syntax assigns them to variables.
  3. jdmonthname() with CAL_MONTH_FRENCH returns the month name for the same Julian Day.
  4. jdtogregorian() shows the same day in the normal calendar.

Frequently Asked Questions

It returns a date in the French Republican calendar as text in the form month/day/year, for example 1/1/1 for the first day of the calendar.
The Julian Day is outside the range that PHP supports, which is September 22, 1792 to September 22, 1806. Modern dates, like anything in 2024, always give 0/0/0.
It is the group of extra days at the end of the year. There are 5 of these days in a normal year and 6 in a leap year.
Use jdmonthname($jd, CAL_MONTH_FRENCH). It returns names such as Vendemiaire and Brumaire.
Yes. If the function is undefined, enable extension=calendar in php.ini or install the php-calendar package.

Next: jdtogregorian()

jdtogregorian() converts a Julian Day number into a Gregorian month/day/year string.

jdtogregorian() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful