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.getStri ng("c.inou t")%></td>
<Td bgcolor="#ffffff" align=center><%=rs.getStri ng("c.call date")%></ td>
<Td bgcolor="#ffffff" align=center><%=rs.getStri ng("c.call time")%></ td>
<Td bgcolor="#ffffff" align=center><%=rs.getTime ("c.callle ngth")%></ td>
<Td bgcolor="#ffffff" align=center><%=rs.getStri ng("c.inco ming")%></ td>
<Td bgcolor="#ffffff" align=center><%=rs.getStri ng("c.rece iving")%>< /td>
<Td bgcolor="#ffffff" align=center><%=rs.getStri ng("e.Name ")%></td>
<Td bgcolor="#ffffff" align=center><%=rs.getStri ng("c.numb er")%></td >
</tr>
<%
}
con.close();
Thanks in advance
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.getStri
<Td bgcolor="#ffffff" align=center><%=rs.getStri
<Td bgcolor="#ffffff" align=center><%=rs.getStri
<Td bgcolor="#ffffff" align=center><%=rs.getTime
<Td bgcolor="#ffffff" align=center><%=rs.getStri
<Td bgcolor="#ffffff" align=center><%=rs.getStri
<Td bgcolor="#ffffff" align=center><%=rs.getStri
<Td bgcolor="#ffffff" align=center><%=rs.getStri
</tr>
<%
}
con.close();
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.