Jump to content

[SOLVED] mktime


Daney11

Recommended Posts

Hi guys.

 

I have

 

<?php

$daymin = "01";
$monthmin = "01";
$yearmin = "1971";

$daymax = "30";
$monthmax = "12";
$yearmax = "1991";

for ($i = 1; $i < 22; $i++)

{

$dayofage = mt_rand($daymin, $daymax);
$monthofage = mt_rand($monthmin, $monthmax);
$yearofage = mt_rand($yearmin, $yearmax);

$bdayunix = mktime('', '', '', $monthofage, $dayofage, $yearofage);

$nowunix = time();
$ageunix = $nowunix - $bdayunix;
$age = floor($ageunix / (365 * 24 * 60 * 60)); 

echo "$dayofage   $monthofage   $yearofage   Age - $age<br />";

}

?>

 

And im getting the error

 

Warning: mktime() expects parameter 1 to be long, string given in D:\server\age.php on line 19

 

It work on my other server but not this.

 

Any help would be great.

 

Thanks guys.

Link to comment
https://forums.phpfreaks.com/topic/44027-solved-mktime/
Share on other sites

Archived

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

×
×
  • 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.