<SCRIPT language=JavaScript>
<!--
var now = new Date();
var today = new Date(now.getYear(),now.getMonth(),now.getDate());
var yearNow =now.getYear()+1900; //2015;
var monthNow = now.getMonth();
var dateNow = now.getDate();
var yearDob = 2000;
var monthDob = 5;
var dateDob = 2;
var age = {};
yearAge = yearNow - yearDob;
if (monthNow >= monthDob)
var monthAge = monthNow - monthDob;
else {
yearAge--;
var monthAge = 12 + monthNow -monthDob;
}
if (dateNow >= dateDob)
var dateAge = dateNow - dateDob;
else {
monthAge--;
var dateAge = 31 + dateNow - dateDob;
if (monthAge < 0) {
monthAge = 11;
yearAge--;
}
}
age = {
years: yearAge,
months: monthAge,
days: dateAge
};
var res = ""; // result
if (age.years == 1) res += "<strong>1</strong> год";
else if (age.years > 1 && age.years < 5)
res += "<strong>" + age.years + "</strong> года";
else if (age.years >= 5) res += "<strong>" + age.years + "</strong> лет";
if (age.days == 0) res += " ";
else res += ", ";
if (age.months == 1) res += "<strong>1</strong> месяц";
else if (age.months > 1 && age.months < 5)
res += "<strong>" + age.months + "</strong> месяца";
else if (age.months >= 5)
res += "<strong>" + age.months + "</strong> месяцев";
if (age.months == 0) res += " ";
else res += " ";
if ((age.years > 0 || age.months > 0) && age.days > 0) res += " и ";
if (age.days == 1 || age.days == 21) res += "<strong>" + age.days + "</strong> день";
else if (age.days == 2 || age.days == 3 || age.days == 4 || age.days == 22 || age.days == 23 || age.days == 24)
res += "<strong>" + age.days + "</strong> дня";
else if (age.days >= 5) res += "<strong>" + age.days + "</strong> дней";
document.write(res);
-->
</SCRIPT>