jdtounix

(PHP 4, PHP 5)

jdtounixConverte do formato de dada Juliana para Unix timestamp

Descrição

int jdtounix ( int $jday )

Esta função irá retorna a data do sistema Unix correspondente ao "Julian Day" especificado no parâmetro jday ou FALSE se jday não está dentre a escala de datas Unix (Anos Gregorianos entre 1970 e 2037 ou 2440588 <= jday <= 2465342). A hora retornada é a hora local (e não a GMT).

Parâmetros

jday

O número de um data juliana entre 2440588 e 2465342.

Valor Retornado

O unix timestamp para o ínicio da dada data juliana.

Veja Também

  • unixtojd() - Converte datas do sistema Unix para data Juliana

add a note add a note

User Contributed Notes 4 notes

up
0
fabio at llgp dot org
7 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
up
0
Anonymous
9 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!!
up
0
seb at carbonauts dot com
10 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.
up
0
pipian at pipian dot com
11 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