kingsofjupiter
asked on
Difference in days
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?
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It seems the whole while loop is executing only once, the inner while loop i mean, I am trying out some other options using the same code, also it seems if the database has date value as NULL which it will have incase of unoccupied Wards, the query loop is exiting straightaway after finding a single null.
>>the inner while loop i mean
There isn't one - that's the problem
There isn't one - that's the problem
ASKER
Thanks a lot, I fixed the problem, output now is coming perfectly, and when it is null, it is not even showing the output for the record corresponding the null value, so thats good as well.
Thanks a lot.
Thanks a lot.
Good ;-)
ASKER
Open in new window