don't know if there is some "date_diff" -like function, but you can do it
this way:

$now = getdate();
$nw_year = $now["year"];
$nw_month = $now["mon"];
$nw_day = $now["mday"];

$chk_date = "09/02/1977";
list ($chk_day, $chk_month, $chk_year) = explode("/", $chk_date);

print $nw_year;
$age = $nw_year - $chk_year;
if ($nw_month<$chk_month) $age--;
if ($nw_month==$chk_month && $nw_day<$chkday) $age--;

print "<BR>age: ".$age;



assuming that the date : "dd/mm/yyyy"

greets,

edward


----- Original Message -----
From: "André Felix Miertschink" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 09, 2002 8:08 PM
Subject: [PHP] Age


> Could anybody find out the simplest method of calculating the age?
> The date of birth is in the format string ('01/01/1977').
>
> André
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to