Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Java/JSP add Time

Posted on 2007-03-28
1
430 Views
Last Modified: 2013-11-23
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
0
Comment
Question by:AndriesKeun
1 Comment
 
LVL 30

Accepted Solution

by:
Mayank S earned 125 total points
ID: 18809174
Probably use the Calendar class and the add () method:

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html#add(int,%20int)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 104
jdbc error in jsp application 20 63
eclipse apache tomcat admin console 52 121
Java string replace 11 54
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question