List Info

Thread: note 74194 added to function.unixtojd




note 74194 added to function.unixtojd
user name
2007-03-29 06:33:10
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("$ => (%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.wiki
pedia.org/wiki/Unix_time
Julian Date Converter: htt
p://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 -- ht
tp://www.php.net/manual/en/function.unixtojd.php
Edit        -- https://master
.php.net/note/edit/74194
Del: integrated  -- h
ttps://master.php.net/note/delete/74194/integrated
Del: useless     -- http
s://master.php.net/note/delete/74194/useless
Del: bad code    -- htt
ps://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     -- http
s://master.php.net/note/delete/74194/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/74194
Reject      -- https://mast
er.php.net/note/reject/74194
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )