long seconds = rs.getTime("nfrm_time").getTime() / 1000
Here is an explanation:
rs.getTime("nfrm_time") returns java.sql.Time , which is actually a subclass of java.util.Date .
java.util.Date.getTime() returns the time in milliseconds that we divide by 1000 to get the seconds.
Note:
If you are looking for duration,
Calendar cal = Calendar.getInstance(); cal.setTime(rs.getTime("nfrm_time")); // set to the time returned by resultset cal.set(0, 0, 0); // reset the year, month and date fields Calendar cal2 = Calendar.getInstance(); cal2.set(0, 0, 0, 0, 0, 0); // reset all the fields, including time long duration = ((cal.getTimeInMillis() - cal2.getTimeInMillis()) / 1000) + 1;
source share