note 74194 added to function.unixtojd

From: Date: Thu, 29 Mar 2007 11:33:10 +0000
Subject: note 74194 added to function.unixtojd
Groups: php.notes 
Request: Send a blank email to php-notes+get-124914@lists.php.net to get a copy of this message
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 ---- Server IP: 212.24.129.110 Probable Submitter: 217.198.112.101 ---- Manual Page -- http://www.php.net/manual/en/function.unixtojd.php Edit -- https://master.php.net/note/edit/74194 Del: integrated -- https://master.php.net/note/delete/74194/integrated Del: useless -- https://master.php.net/note/delete/74194/useless Del: bad code -- https://master.php.net/note/delete/74194/bad+code Del: spam -- https://master.php.net/note/delete/74194/spam Del: non-english -- https://master.php.net/note/delete/74194/non-english Del: in docs -- https://master.php.net/note/delete/74194/in+docs Del: other reasons-- https://master.php.net/note/delete/74194 Reject -- https://master.php.net/note/reject/74194 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#124914) next »