Butt, Dudley wrote:
I know you guys are all excellent java programmers, so I do believe someone has what 
I'm looking for? I really please need a date utility class that
accurately calculates the number of years between 2 dates? Would appreciate it very 
much thx!!

I can think of 2 ways of measuring this.


You are either looking for

a. an elapsed time in years
b. difference of year values

As an example using these 2 dates: 31 Dec 2000 and 1 Jan 2001
You would get a difference for (a) 0 years, (b) 1 year.

You would calculate (a) by getting the time in milliseconds for each date and subtracting one from the other, the figure out how many years have gone by. (b) is calculated by using the Calendar, extract the year component of each date and subtract one from the other.

Here are some useful examples from The Java Developers Almanac 1.4

http://javaalmanac.com/egs/java.util/GetAge.html


-- Jason Lea


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to