Example 1 — Julian Day to Timestamp
Convert the Unix epoch day and January 1, 2024, then print them with gmdate().
<?php
echo jdtounix(2440588), PHP_EOL;
$timestamp = jdtounix(gregoriantojd(1, 1, 2024));
echo $timestamp, PHP_EOL;
echo gmdate('Y-m-d H:i:s', $timestamp), PHP_EOL; How It Works
- Julian Day 2440588 is the Unix epoch, January 1, 1970, so the timestamp is 0.
- gregoriantojd() turns January 1, 2024 into a Julian Day number.
- jdtounix() returns 1704067200, the number of seconds since 1970.
- gmdate() prints the timestamp as 2024-01-01 00:00:00 in UTC.

