downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

JewishToJD> <JDToJulian
[edit] Last updated: Fri, 23 Mar 2012

view this page in

jdtounix

(PHP 4, PHP 5)

jdtounixJülyen Gün Sayısını, Unix zaman damgasına çevirir

Açıklama

int jdtounix ( int $julyengunu )

İşlev julyengunu'ne karşılık gelen Unix zaman damgasını ya da verilen julyengunu Unix zaman damgası aralığında (1970 ve 2037 Gregoryen yılları arası veya 2440588 <= julyengunu <= 2465342 ) değilse FALSE değerini döner. İşlevden dönen zaman damgası, GMT'ye göre değil, yerel zamana göredir.

Değiştirgeler

julyengunu

2440588 ve 2465342 aralığında Jülyen Gün Sayısı.

Dönen Değerler

Jülyen Gün Sayısına, karşılık gelen Unix zaman damgası.

Ayrıca Bakınız

  • unixtojd() - Unix zaman damgasını, Jülyen Gün Sayısına çevirir



JewishToJD> <JDToJulian
[edit] Last updated: Fri, 23 Mar 2012
 
add a note add a note User Contributed Notes jdtounix
hrabi at linuxwaves dot com 29-Mar-2007 01:16
Beware, jd here is not (astronomical or geocentric) Julian Day (JD), but Chronological Julian Day (CJD)! When JD start at noon of UTC time (12:00 UTC), CJD start at midnight at *local* time! Or considering head "Chronlogical Julian Day/Date" at "http://www.decimaltime.hynes.net/dates.html", when day localy start (it should be at sunset for instance).

try this...
<?php
define
("UJD", 2440587.5);
define("SEC4DAY", 86400);

function
u2j($tm) {
   return
$tm / SEC4DAY + UJD;
}

function
mmd($txt, $str_time) {
  
$t = strtotime($str_time);
  
$j = unixtojd($t);
  
$j_fabio = u2j($t);
  
$s = strftime('%D %T %Z', $t);

  
printf("${txt} => %s, CJD: %s, JD: %s<br>\n", $s, $j, $j_fabio);
}

$xt = strtotime("1.1.1970 0:00.00 GMT");
$slb = "-1 day 23:30"; // let CJD be N
$sla = "0:30.00"; // should be N+1
$slm = "0:00"; // should be N+1
$sgmt = "0:00.00 GMT"; // don't forget to observe JD.

mmd("local before", $slb);
mmd("local after", $sla);
mmd("local midnight", $slm);
mmd("GMT midnight", $sgmt);
?>

I got this (you see, JD havn't change day, because UTC noon is far away):
local before => 03/28/07 23:30:00 CEST, CJD: 2454188, JD: 2454188.39583
local after => 03/29/07 00:30:00 CEST, CJD: 2454189, JD: 2454188.4375
local midnight => 03/29/07 00:00:00 CEST, CJD: 2454189, JD: 2454188.41667
GMT midnight => 03/29/07 02:00:00 CEST, CJD: 2454189, JD: 2454188.5
erelsgl dot NOSPAM at cs dot technion dot ac dot il 19-Sep-2006 12:31
Just to clarify the differences between the different methods to convert a date to a timestamp.

Suppose:

<?php
$x
= JDToUnix(GregorianToJD(9,23,2006));
$y = strtotime('2006-09-23');
$z = (GregorianToJD(9,23,2006) - 2440587.5) * 86400;
?>

Then, on a machine whoze timezone is GMT-0400, we get the following results:
<?php
$x
=== 1158969600;
$y === 1158984000//  $x + 4 hours
$z === 1159012800//  $x + 12 hours
?>
fabio at llgp dot org 30-Aug-2006 08:14
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
26-Jan-2005 11:50
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!!
seb at carbonauts dot com 21-Oct-2003 06:10
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.
pipian at pipian dot com 12-Jun-2003 03:29
Remember that UNIX timestamps indicate a number of seconds from midnight of January 1, 1970 on the Gregorian calendar, not the Julian Calendar.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites