According to this, I'm 44 not 45 :)p

$birthday = '1965-08-30';

//calculate years of age (input string: YYYY-MM-DD)

  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 ($day_diff < 0 || $month_diff < 0)
      $year_diff--;
    return $year_diff;
  }

echo birthday ($birthday);



John Taylor-Johnston wrote:
I'm working my way right now through the manual: http://ca.php.net/manual/en/function.strtotime.php.



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

Reply via email to