$day = cal_to_jd(CAL_GREGORIAN,2,2,2010); // Julian Day count
$day_unix=jdtounix($day); // Unix time stamp
echo date('m/d/y',$day_unix);// In date format
The output is here 02/02/10
We can get unix time stamp by using gdtounix() function. Here we will use Julian Date ( Integer )as input.
jdtounix(JD_day);
Here is an example.
Note: jdtounix() returns the local time, where Unix Timestamp generator uses GMTAfter converting the Julian Day number to a Unix timestamp, you can format it to a human-readable date:
$jd = 2459580;
$unix = jdtounix($jd);
echo date("Y-m-d H:i:s", $unix);
// Outputs: 2022-03-28 12:00:00
You can calculate the number of days between two Julian dates by converting both to Unix timestamps:
$jd1 = 2459580;
$jd2 = 2459585;
$days_diff = ($jd2 - $jd1);
echo "Difference in days: " . $days_diff;
// Outputs: Difference in days: 5
This example shows how to convert a Gregorian date to a Julian date and then to a Unix timestamp:
$gregorian_date = gregoriantojd(3, 28, 2022);
$unix_timestamp = jdtounix($gregorian_date);
echo date("Y-m-d", $unix_timestamp);
// Outputs: 2022-03-28