u rs.next () is missing before printing.
To print 24:00: rs.getTime will return a Time object in the format "HH:mm" (00:00 to 23:00) . if you want the time from (01:00-24:00) format the time using the simpledateformat("kk:mm").format() method, as shown below.
Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("SELECT * FROM student"); while(rs.next()) { // if resutset not empty System.out.println(new SimpleDateFormat("kk:mm:ss").format(rs.getTime("time").getTime())); //
}
check out the ResultSet API for more info :)
source share