unixtojd() accepts a Unix timestamp and returns the corresponding Julian Day count.
$timestamp = strtotime('2026-09-14 00:00:00 UTC');
echo unixtojd($timestamp);Current example first; the detailed examples and demos below are retained for additional learning and comparison.
\=time(); // time stamp of today.
echo "Time Stamp = \ ";
\=unixtojd(\);
echo "Julian Day by using unixtojd() : \ ";
The output is here
By using unix time stamp we can generate Julian date calendar or any other calendar.
unixtojd(time_stamp);
Time Stamp = 1790784572 Julian Day by using unixtojd() : 2461314 $timestamp = time();
echo unixtojd($timestamp); // Output: Julian day for the current Unix timestamp
$specific_date = mktime(0, 0, 0, 1, 1, 2000);
echo unixtojd($specific_date); // Output: Julian day for January 1, 2000
$date_before_1970 = mktime(0, 0, 0, 12, 31, 1965);
echo unixtojd($date_before_1970); // Output: Julian day for December 31, 1965
$date_str = strtotime('2022-03-15');
echo unixtojd($date_str); // Output: Julian day for March 15, 2022
$future_date = mktime(0, 0, 0, 1, 1, 2030);
echo unixtojd($future_date); // Output: Julian day for January 1, 2030
$epoch = mktime(0, 0, 0, 1, 1, 1970);
echo unixtojd($epoch); // Output: Julian day for the Unix Epoch
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.