subtracting dates...

From: Date: Sat, 02 Aug 2003 19:30:34 +0000
Subject: subtracting dates...
Groups: php.db php.general 
Request: Send a blank email to php-db+get-29636@lists.php.net to get a copy of this message
Hi, In mySQL, I store dates as YYYY-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 birthdays in june of 1983 and the date is januray 2003, your age is still returned as 20, when it should be 19. Does anyone know how can i get the right age?

« previous php.db (#29636) next »