Jump to content


Photo

date difference issue


  • Please log in to reply
No replies to this topic

#1 proctk

proctk
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts

Posted 15 October 2006 - 11:22 PM

Hi I use the below function to calculate the years between two years. 

Everything works fine on my test server which uses mysql 5 and php 5

For some reason its not working on my web server, which uses verion 4.1php and 4.0.27 mysql.

<?
function dateDiff($dformat, $endDate, $beginDate)
{
           $date_parts1=explode($dformat, $beginDate);
           $date_parts2=explode($dformat, $endDate);
           $start_date=gregoriantojd($date_parts1[1], $date_parts1[2], $date_parts1[0]);
           $end_date=gregoriantojd($date_parts2[1], $date_parts2[2], $date_parts2[0]);
           return $end_date - $start_date;
} 

?>



statement to ge the value

$age = round(dateDiff("-",date("Y-m-d", time()), $dob)/365, 0);

my page stops once it hits this line of code. no error messages are given.  I confirmed the error is with this because when I comment it out it works fine

any help is grerwta




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users