Jump to content

date difference issue


proctk

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.