note 37823 added to function.mktime
| From: | verszuz at hotmail dot com | Date: | Fri, 28 Nov 2003 14:53:42 +0000 |
| Subject: | note 37823 added to function.mktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-61074@lists.php.net to get a copy of this message | ||
I figured out this way to calculate your age using mktime:
<?php
$day=27;//the day of birth variable
$month=10;//the month of birth variable
$year=1977;// the year of birth variable
$now=mktime();
echo $now."<br>";
$timebirth=mktime(0,0,0,$month,$day,$year);
echo $timebirth."<br>";
$agetime=$now-$timebirth;
echo ((strftime("%Y",$agetime))-(strftime("%Y",0)));
?>
I hope this will help. Remember this calculator does not work properly on windows because of the
limited range of mktime().
----
Manual Page -- http://www.php.net/manual/en/function.mktime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37823
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37823&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37823&report=yes
Search -- http://master.php.net/manage/user-notes.php