> In mySQL, I store dates as -MM-DD, a standard DATE type. It stores
users
> date of births. I need to calculate in a PHP script, the users age from
this
> DOB. I get a PHP date in the same format as the mySQL and subtract, which
> returns the year rounded off. ie, it doesnt matter if your bir
I found this code at Google's cached version of the manual for the
date() function:
http://216.239.37.104/search?q=cache:kq0aNfZeEp8J:www.php.net/date+diffe
rence+two+date+site:www.php.net&hl=en&ie=UTF-8
This code only returned the number of hours, minutes, and seconds
between the two points in ti
Try this (taken from http://us2.php.net/manual/en/ref.datetime.php):
*menaurus at gmx dot de*
16-Jul-2003 02:37
|The argument has to be in the standard mysql format (y-m-d)...
function age($date) {
if (!$date) return false;
$year=0+substr($date,0,4);
$month=0+substr($date,5,2);
$day=0+subs