Difference in days
Posted on 2008-11-15
I have two Date parameters from DB2 database, as Startdate and Enddate, In query string i am calling them as,
java.sql.Date hi = rs.getDate("STARTDATE");
java.sql.Date hi1 = rs.getDate("ENDDATE");
How do i find the difference in number of days in integer between these two dates?
I have tried out many ways, but none seems to work, the milliseconds thing isnt working as well. Only the gregorian calendar thing worked under given date, but then how do i add Startdate and Enddate to a Gregoriancalendar?
Calendar then = new GregorianCalendar(2008, Calendar.OCTOBER, 27);
Calendar now = new GregorianCalendar();
Like say for how do i add the date there instead of the predefined date?