| Author |
reg age cal
|
vijay kumar
Ranch Hand
Joined: Nov 10, 2006
Posts: 62
|
|
hi, How to caluculate a age if date of birth is in this format 01/12/1875 Regards, Vijay.
|
 |
Steve Fahlbusch
Ranch Hand
Joined: Sep 18, 2000
Posts: 496
|
|
Sorry, don't know what it is you are requesting? Are you asking: a) If i have a date in mm/dd/yyyy format how do i contvert that to a date so i can calculate age?, or b) What is the algorithm given a date to determine one's age?, and if so what is the format of the age (years old, years and days, years and months and days, ...hours? minutes? seconds?
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
Look at SimpleDateFormat. You can use that to parse a String into a Date object. If you build Date objects for current time and birth date, you can work out the time between them with pretty simple math. Look at the doc for Date ... do you see a method that returns a number we might do math on? See if you can compute age in days or years. Avoid months - they're all different sizes which makes them mostly meaningless. These are pretty vague hints ... I hope you have fun digging out the details yourself.
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
|
|
"if date of birth is in this format 01/12/1875" So, is that January 12th, or 1 December? Using 01/12 as an example for date/month or month/day isn't very informative in an international context. Try 01/31 or 31/12.
|
"I'm not back." - Bill Harding, Twister
|
 |
 |
|
|
subject: reg age cal
|
|
|