Solved

Java/JSP add Time

Posted on 2007-03-28
1
434 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
[X]
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
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

730 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