View Single Post
Old 12-09-2008, 02:08   #1 (permalink)
laksh_khamesra
Registered User
 
Join Date: Sep 2008
Posts: 13
How to take out user's AGE in PHP?

This code i have made to take out age of the user(the date in the mktime is just for testing). But many problems are occurring like if the user was born on 2nd of a month today is 1st of a month then the date comes in minus (-) which makes it too confusing... After all, i m completely stuck & confused. Please tell how to take out users age.

PHP Code:
$td mktime(0,0,0,05,24,1991);
$td1 time();

$aa date("Y"$td);
$bb date("Y"$td1);
$age $bb $aa;

$cc date("m"$td);
$dd date("m"$td1);
$month $dd $cc;

$ee date("d"$td);
$ff date("d"$td1);
$days $ff $ee;

echo 
"$age years, $month months and $days days"
  Reply With Quote