Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: eight plus zero?
(Example: nine)

The Note You're Voting On

hrabi at linuxwaves dot com
18 years ago
This is unusable. Julian Day start at noon, not midnight. It's better to use Fabio solution (however there is a lurk problem with leap second).

<?php
function mmd($txt, $str_time) {
$t = strtotime($str_time);
$j = unixtojd($t);
$s = gmstrftime('%D %T %Z', $t);
$j_fabio = $t / 86400 + 2440587.5;

printf("${txt} => (%s) %s, %s U, %s J, or %s J<br>\n", $str_time, $s, $t, $j, $j_fabio);
}

//$xt = strtotime("1.1.1970 15:00.00 GMT");
$sam = "9.10.1995 02:00.01 GMT";
$spm = "9.10.1995 22:00.01 GMT";

// unixtojd for $spm returns 2450000 (OK), but for $sam returns 2450000 too! (it is wrong).
mmd("am", $sam); // should be 2449999 (+ 0.58334)
mmd("pm", $spm); // should be 2450000 (+ 0.41668)
?>

reference
unix time, and UTC, TAI, ntp, ... problems: http://en.wikipedia.org/wiki/Unix_time
Julian Date Converter: http://aa.usno.navy.mil/data/docs/JulianDate.html
history overview: http://parris.josh.com.au/humour/work/17Nov1858.shtml

<< Back to user notes page

To Top