PHP 7.1.0 Release Candidate 4 Released


(PHP 4, PHP 5, PHP 7)

jdtounixConvertit un jour Julien en timestamp UNIX


int jdtounix ( int $jday )

Retourne un timestamp UNIX correspondant au jour Julien jday ou FALSE si jday n'est pas dans l'intervalle de validité de l'époque UNIX. (années grégoriennes entre 1970 et 2037 ou 2440588 <= jday <= 2465342 .) Le temps retourné est un temps local (et non GMT).

Liste de paramètres


Le nombre de jours Julien, compris entre 2440588 et 2465342.

Valeurs de retour

Le timestamp unix pour le début du jour Julien donné.

Voir aussi

  • unixtojd() - Convertit un timestamp UNIX en un jour Julien

add a note add a note

User Contributed Notes 5 notes

seb at carbonauts dot com
13 years ago
Remember that unixtojd() assumes your timestamp is in GMT, but jdtounix() returns a timestamp in localtime.

This fooled me a few times. 

So if you have:

$timestamp1 = time();
$timestamp2 = jdtounix(unixtojd($timestamp1));

Unless your localtime is the same as GMT, $timestamp1 will not equal $timestamp2.
fabio at llgp dot org
10 years ago
If you need an easy way to convert a decimal julian day to an unix timestamp you can use:

$unixTimeStamp = ($julianDay - 2440587.5) * 86400;

2440587.5 is the julian day at 1/1/1970 0:00 UTC
86400 is the number of seconds in a day
11 years ago
Warning: the calender functions involving julian day operations seem to ignore the decimal part of the julian day count.

This means that the returned date is wrong 50% of the time, since a julian day starts at decimal .5 .  Take care!!
Saeed Hubaishan
2 years ago
unixtojd() assumes that your timestamp is in GMT, but jdtounix() returns a timestamp in localtime.
$d2= gmdate("m/d/Y");
$d1 always equals $d2 but $d1 may differ from $d3
pipian at pipian dot com
13 years ago
Remember that UNIX timestamps indicate a number of seconds from midnight of January 1, 1970 on the Gregorian calendar, not the Julian Calendar.
To Top