Cálculo de edad

Submitted by admin on Thu, 03/27/2008 - 03:34

Message: 2
Date: Tue, 21 Feb 2006 12:25:10 -0500 (GMT-05:00)
From: Jeff Haney
Reply-To: Jeff Haney
To: apc-aa-general@lists.sourceforge.net
Subject: [Apc-aa-general] Re: Calculating age

I guess I answered my own question; I just wrote my first custom alias function which wasn't as hard as I thought it would be. In case anybody is interested, the function is added to the /include/usr_aliasfnc.php3 file and is as follows:

function usr_calc_age($columns, $col, $param="") {
$age = $columns[$col][0][value];
$diff = (date("Y") - date("Y",$age));
if (mktime(0,0,0,date("m",$age),date("j",$age),date("Y")) return $diff;
return $diff -1;

I'm still not sure if this is the most efficient way to accomplish this. I think the main requirement is the ability to determine the current date dynamically and I'm not sure of another way to do that other than a user function. Maybe one of the experts can comment...