Re: Month difference between dates



zamba <CRISTIAN_FERRERO@xxxxxxxxxxx> wrote:
Hi i want to know if there is a way to know exactly the number of
months (instead o days) between to diferent dates..

I sometimes ask this as an interview question, and the only good answer is
to ask me questions about what exactly I want. I'll do the same: please
specify what you mean by "number of months between two dates".

How many months are between Jan 1 and Jan 2? Jan 1 and Jan 30? Jan 1 2007
and Dec 31 2006? Feb 1 and 28 days afterward in 2007? in 2008?

For most reasonable definitions, the java.util.Calendar class will get you the
information you need to calculate the answer.
--
Mark Rafn dagon@xxxxxxxxx <http://www.dagon.net/>

.