String sql = "SELECT endtime FROM user_req";
ResultSet rs = stmt.executeQuery(sql);
ArrayList<Timestamp> list1= new ArrayList<Timestamp>();
while (rs.next()) {
list1.add(rs.getTimestamp("endtime"));
}
System.out.println("\n the requested time is : ");
System.out.println(list1);
this gives me the result:-
the requested time is :
[2013-12-12 07:00:00.0, 2013-12-12 05:00:00.0]
this is the code which I've used that retrieves the timestamp data from MySQL and stores it in an aaraylist. but how to compare those dates and get the difference in terms of days and hours. please help me and thanks in advance.