I have to calculate the difference between two dates. Here is my code:
        System.out.println("date1  "+date1);
        System.out.println("date2  "+date2);
        totalDifference=date2.getSeconds()-date1.getSeconds();
        System.out.println("Total Difference is"+totalDifference);
The problem that I am facing is that the result is 0:
 09-24 17:24:53.839: I/System.out(9317): date1  Wed Aug 15 00:00:00 GMT+05:30 2012
 09-24 17:24:53.839: I/System.out(9317): date2  Mon Sep 24 17:24:00 GMT+05:30 2012
 09-24 17:24:53.839: I/System.out(9317): Total Difference is 0
What I am doing wrong?
Thanks guys for the solution and other valuable resources,Please help me for this question also. Hey suppose if I enter 31st Aug 23:59:00 and next date 1 Sept 00:02:00 , I need to show the record as 1 day. Please help me for this one
 
     
     
     
     
     
    