Jump to content

Archived

This topic is now archived and is closed to further replies.

proctk

date difference issue

Recommended Posts

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.

[code=php:0]
<?
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;
}

?>

[/code]


statement to ge the value

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

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.