PHP Doku:: Konvertiert Unix-Timestamp in Julianisches Datum - function.unixtojd.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatums- und zeitrelevante ErweiterungenKalenderCalendar Funktionenunixtojd

Ein Service von Reinhard Neidl - Webprogrammierung.

Calendar Funktionen


Datum und Uhrzeit>>


(PHP 4, PHP 5)

unixtojd Konvertiert Unix-Timestamp in Julianisches Datum


int unixtojd ([ int $timestamp = time() ] )

Diese Funktion konvertiert den in timestamp übergebenen Wert (in Sekunden seit dem 1.1.1970) in das entsprechende Julianische Datum. Wird kein timestamp übergeben, so wird das Julianische Datum des aktuellen Tages zurückgegeben.



Ein zu konvertierender Unix Timestamp.


Ein Julianischer Tag als Integer.

Siehe auch

  • jdtounix() - Konvertiert Julianisches Datum in Unix-Timestamp

6 BenutzerBeiträge:
- Beiträge aktualisieren...
hrabi at linuxwaves dot com
29.03.2007 16:02
according to and reading "X. Calendar Functions" on this side, it seems that php "jd" is precisely mean as "Chronological Julian Day" (should it be named cjd, and primarily strictly mentioned - isn't it?), used for covnersion between calendar systems. Than it's ok (but Incomplete manual is strongly confusing here IMHO).
Even that, cJD is adjusted to a local time, so... I am rather babeled now, so nothing else :-).
hrabi at linuxwaves dot com
29.03.2007 13:33
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).

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)

unix time, and UTC, TAI, ntp, ... problems:
Julian Date Converter:
history overview:
fabio at llgp dot org
31.08.2006 11:09
If you need an easy way to convert an unix timestamp to a decimal julian day you can use:

$julianDay = $unixTimeStamp / 86400 + 2440587.5;

86400 is the number of seconds in a day;
2440587.5 is the julian day at 1/1/1970 0:00 UTC.

11.08.2006 4:22
Its clearly stated that this function returns the Julian Day, not Julian Day + time.

If you want the time with it you will have to do something like:

johnston at capsaicin dot ca
19.11.2003 22:43
Also note that epoch is in UTC time (epoch is a specific point in time - epoch is not different for every time zone), so be aware of timezone complexities.
pipian at pipian dot com
12.06.2003 18:29
Remember that UNIX timestamps indicate a number of seconds from midnight of January 1, 1970 on the Gregorian calendar, not the Julian Calendar.

PHP Powered Diese Seite bei
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)