Link to home
Start Free TrialLog in
Avatar of AndriesKeun
AndriesKeun

asked on

Java/JSP add Time

Hi there

I have a variable in my SQL DB called 'calllength' of type 'time' in the format: 00:05:12 and I want to add up all these totals to give me a total time. How do i go about doing this?

The main problem is that I dont know what type of variable to make it as, and how to essentially add the times. I have tried a few things but mainly get the incompatible types error message. Heres my code:

rs = stmt.executeQuery("select * from calldata c, extensions e where c.receiving = e.extension and calldate = '2007-03-21'");
      while (rs.next()){      
      
      %>
            <TR>
                  <Td  bgcolor="#ffffff" align=center><%=rs.getString("c.inout")%></td>
                  <Td  bgcolor="#ffffff" align=center><%=rs.getString("c.calldate")%></td>
                  <Td  bgcolor="#ffffff" align=center><%=rs.getString("c.calltime")%></td>
                  <Td  bgcolor="#ffffff" align=center><%=rs.getTime("c.calllength")%></td>
                  <Td  bgcolor="#ffffff" align=center><%=rs.getString("c.incoming")%></td>  
                  <Td  bgcolor="#ffffff" align=center><%=rs.getString("c.receiving")%></td>
                  <Td  bgcolor="#ffffff" align=center><%=rs.getString("e.Name")%></td>
                  <Td  bgcolor="#ffffff" align=center><%=rs.getString("c.number")%></td>  
            </tr>
      <%       
                }
       con.close();

Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial