I need some help creating an age calculator which will display your exact date example:
Birth date: 2000-11-03
Date Today: 2009-11-18
Exact age: 9 years 0 months 15 days
Any idea on how can this be done? Sample codes is much appreciated
Thanks
need healp age calculator
Moderator: General Moderators
-
greedyisg00d
- Forum Commoner
- Posts: 42
- Joined: Thu Feb 12, 2009 2:48 am
- angelicodin
- Forum Commoner
- Posts: 81
- Joined: Fri Nov 13, 2009 3:17 am
- Location: Oregon, USA
Re: need healp age calculator
Well there are quite a few ways to go about this.
To get the person's B-Day you could do a two page deal with a form and post, or single page using get (depending on how your are going to use it).
For getting today's date is vary easy "date()" then you just input how you want it to be formatted. Click HERE for the date manual.
After that bit of information it's just some simple math. ;p
If you are trying to learn, HTH, otherwise I can whip up an example for you.
To get the person's B-Day you could do a two page deal with a form and post, or single page using get (depending on how your are going to use it).
For getting today's date is vary easy "date()" then you just input how you want it to be formatted. Click HERE for the date manual.
After that bit of information it's just some simple math. ;p
If you are trying to learn, HTH, otherwise I can whip up an example for you.
- Grizzzzzzzzzz
- Forum Contributor
- Posts: 125
- Joined: Wed Sep 02, 2009 8:51 am
Re: need healp age calculator
greedyisg00d wrote:I need some help creating an age calculator which will display your exact date example:
Birth date: 2000-11-03
Date Today: 2009-11-18
Exact age: 9 years 0 months 15 days
Any idea on how can this be done? Sample codes is much appreciated
Thanks
get the person to post their Date of Birth
use the date function to get todays date
http://php.net/manual/en/function.date.php
format it in such a way that it's identical to the way they input it and then it's just simple maths
-
greedyisg00d
- Forum Commoner
- Posts: 42
- Joined: Thu Feb 12, 2009 2:48 am
Re: need healp age calculator
Thanks can you post some sample codes that I can work on. I am currently reading the date manual
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California