<html>
<body>
<script>
function getAge(dateString) {
var today = new Date();
var birthDate = new Date(dateString);
var age = today.getFullYear() - birthDate.getFullYear();
var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
return age;
}
alert(getAge('1983/01/01'));
</script>
</body>
</html>
Bikini Browser kirjutas Pühapäev, 24. detsember 2006 kl 18:32:14 UTC+2:
Folks:
I am not a programmer so I need some help here... I need a small
program
written that tells me how many days old my daughter is since she was
born.
She was born September 26th, 2000. I am keeping a journal for her to
read
when she grows up including photos and I want her to know how many days
old
she is, each day I enter a journal entry.
I am willing to pay a donation to any one willing to help complete this program.
The programmer will have to consider leap years. In fact, I would like
the
program to allow me to enter any birth date I want and tell me how many
days
it was since that date. This way I can use it for other members of my
family as well.
Can anyone help me?
www.daleallen.com
Thanks in advance...
Dale
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)