Jump to content

Recommended Posts

Below is the complet function and the string of code that I'm trying to use to calculate a persons age.

It not wanting on my web server, for some reason when it gets to the point to exicute the string to calcualte the age the code stops runing. everythingis displayed until this point but nothing after.  there are no error message shown either.

Any idea why this is happening.

Thank you

[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]

[code=php:0]
$ownerAge = floor(dateDiff("-", date("Y-m-d"), $dob)/365);
[/code]
Link to comment
https://forums.phpfreaks.com/topic/28394-date-diff-problem/
Share on other sites

possibly because your error reporting has been turned off.  i imagine one of those gregoriantojd() functions is tossing an error for one reason or another.  try these lines at the top of your script:

[code]ini_set('display_errors', 1);
error_reporting(E_ALL);[/code]

@Little Guy:  unless he edited his post (doesn't appear that he has), his usage example is in plain view at the end of his message.
Link to comment
https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-130034
Share on other sites

You can do...

[code]<?phpinfo();?>[/code]

But you really don't need to, because PHP has already told you that a function within the Calendar extension is [b]not defined[/b], which means the Calendar extension is not installed because the function [b]gregoriantojd()[/b] has been a member of the Calendar extension since PHP 3, so it wouldn't be a version difference causing the conflict or better said, a function being [b]undefined[/b].

So ask your host to install it for you...

printf
Link to comment
https://forums.phpfreaks.com/topic/28394-date-diff-problem/#findComment-130127
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.