I need help to count days between 2 dates,where i want to count the days between current date and registeration date.Here is the code that i have write but it only compare the days , it do not compare the month and the year, where it will return 0 if the day of the second date is the same as the first date even the month or year are different, plz help me...
my code:
public static int dayDiff(java.sql.Date date1, java.sql.Date date2)throws Exception
{
long diff = date1.getTime()-date2.getTime();
return (int)diff/1000/60/60/24;
}