note 73243 deleted from function.mktime by nlopess
| From: | nlopess@php.net | Date: | Thu, 15 Feb 2007 13:12:43 +0000 |
| Subject: | note 73243 deleted from function.mktime by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123424@lists.php.net to get a copy of this message | ||
Note Submitter: adyyyy_adyyyy at Yahoo dot com
----
Hello,
I use this function and code to get difference beetween 2 days and i get 2-3 diferent values as i
load the code. First is good and the other are big numbers. Does anybody have an ideea why is that.
I ckeced the dates are ok and generated corectly. I think the mktime function has problems. The
script is runing on hosting that has php 4.4.4 and cpanel. I tested the script on windows server
and it is working. Any ideeas?
function dateDiff($dformat, $endDate, $beginDate)
{
$date_parts1=explode($dformat, $beginDate);
$date_parts2=explode($dformat, $endDate);
$start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
$end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
return $end_date - $start_date;
}
$exp = explode("-",$_SESSION["date"]);
$m=$exp[1];
$d=$exp[2];
$Y=$exp[0];
$date = $m."-".$d."-".$Y;
$date2=date("m-d-Y");
$nrWeeksPassed=(dateDiff("-", $date2, $date)