hello ,
I am facing a problem when i am trying to get the difference between two dates which is been taken from html page through datepicker.
now i am selecting two different dates with different month.for example
d1 dd/mm/yyyy = 12/09/2008
d2 dd/mm/yyyy = 2/10/2008

now i am getting this value in the text box through datepicker.so i am doing it like this to convert it ,first i am getting the parameters by using


SimpleDateFormat df = new SimpleDateFormat("dd/mm/yyyy");
Date d1 = df.parse(datefrom);
Date d2 = df.parse(dateto);

long diff=d2.getTime()-d1.getTime();
long days=(long)(diff/(1000*60*60*24));
String days1 = new StringBuffer("").append(days).toString();

But the problem is that it is not taking the proper selected september and october month else it is showing as only january month for any selected month
Thu Jan 12 00:09:00 GMT+05:30 2008 for d1
wed Jan 02 00:09:02 GMT+05:30 2008 for d2
Please help me out.
Its urgent
Thanks in advance.

Hi masijade,
Thanks a lot dear.You solved my problem.I was stuck into this from hours but was not able to find solution and i didnt even realize that it is such a silly error.once again thank you.

This question has already been answered. Start a new discussion instead.