Hi Bengt
Whose age do you want to calculate? Is this, like, your baby and you're doing a blog charting his/her progress through life?
Well congratulations on becoming a parent. First time? When was the baby born? Let's say it was born on Sunday the 16th of January 2005 at 12 o'clock midday. You can do this:
<?php
$birthDate = mktime(12, 0, 0, 1, 16, 2005); // Unix timestamp for birth
$rightNow = time(); // Current Unix timestamp
$babyAge = $rightNow - $birthDate; //Subtract to get age
$daysbabyAge = round($babyAge/(60*60*24)-1); //Convert age to number of days.
?>
Check the manual for further explanations and to see whether I've made a mistake.
Question is, how do you convert the number of days to something more useful, e.g. years/days/months? This could be tricky. When is a kid one month old? The answer is, usually, on the same day of the month as the kid was born, in the month after the kid was born. So a baby born on the 16th of January 2005 will be described as a month old on the 16 of February. Mathematically, however, this is nonsense. Each month has an average of 30.146666 .... days. In leap years, the average is a nice tidy 30.5. I'll leave it up to you to do the arithmetic and format the result.
HTH
Norm