Source Code:
(back to article)
<?php /** * Convert a Unix timestamp to a Julian date. * * @param int $timestamp The Unix timestamp to convert. * * @return float The Julian date. */ function unix_to_jd($timestamp) { $jd = ($timestamp / 86400) + 2440587.5; $jd_rounded = round($jd); return $jd_rounded + 0.5; } $timestamp = time(); // current Unix timestamp $jd = unix_to_jd($timestamp); echo "Unix timestamp: $timestamp\n"; echo "Julian date: $jd\n";
Result:
Report an issue