Hi.
Try this function;
function calculateAge(dateOfBirth)
{
var today = new Date();
var age = today.getFullYear() - dateOfBirth.getFullYear();
var m = today.getMonth() - dateOfBirth.getMonth();
if (m < 0 || (m === 0 && today.getDate() < dateOfBirth.getDate()))
{
age--;
}
return age;
}
To call it use;
var dateOfBirth = new Date(util.scand("yyyy-mm-dd", DateOfBirth.rawValue).setHours(0,0,0,0));
app.alert(calculateAge(dateOfBirth))
This assume your DateTime Field is called DateOfBirth, I do the setHours bit to make sure there is no time component but you probably don't need it.
Regards
Bruce