|
|
i need code to count days between dates which is the current_date and registration date...i hv already done some coding but it only compare the day and don't compare the month and year.This code return o if the date are same as the current_date even the month and year are different.This is 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;
}