Jump to content

Php Date help.


Vivid Lust

Recommended Posts

<?php
function birthday ($birthday) {
list($year,$month,$day) = explode("-",$birthday);
$year_diff = date("Y") - $year;
$month_diff = date("m") - $month;
$day_diff = date("d") - $day;
if ($month_diff < 0) $year_diff--;
elseif (($month_diff==0) && ($day_diff < 0)) $year_diff--;
return $year_diff;
}
echo birthday("1980-07-02");

?>

 

http://snipplr.com/view/1357/calculate-age/

 

http://www.google.com/search?hl=en&q=php+get+age&btnG=Search

Link to comment
https://forums.phpfreaks.com/topic/91573-php-date-help/#findComment-469063
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.