title: Retrieving MySQL time in java
body: <p>I am running the following query to get time difference of two times</p>
  
  <pre><code>resultSet = statement.executeQuery("SELECT TIMEDIFF('14:03:55.256', '14:02:51.780') AS td");
  </code></pre>
  
  <p>MySQL gives time difference in this format</p>
  
  <pre><code>00:01:03.476
  </code></pre>
  
  <p>But both
      <a href="http://docs.oracle.com/javase/6/docs/api/java/sql/ResultSet.html#getTime%28java.lang.String%29" rel="nofollow"><code>resultSet.getTime("td");</code></a> and <a href="http://docs.oracle.com/javase/6/docs/api/java/sql/ResultSet.html#getObject%28java.lang.String%29" rel="nofollow"><code>resultSet.getObject("td");</code></a>
  <br/>
  returns <code>00:01:03</code> </p>
  
  <p>According to the documentation <a href="http://docs.oracle.com/javase/6/docs/api/java/sql/ResultSet.html#getTime%28java.lang.String%29" rel="nofollow"><code>getTime(String string)</code></a> retrieves the value of the designated column in the current row of this ResultSet object as a <a href="http://docs.oracle.com/javase/6/docs/api/java/sql/Time.html" rel="nofollow"><code>java.sql.Time</code></a> object in the Java programming language.<br/>
  <br> <code>java.sql.Time</code> corresponds to SQL TIME and contains information about <em>hour, minutes, seconds and milliseconds</em>.Then why am I getting <code>00:01:03</code> instead of <code>00:01:03:476</code>?</p>
  
  <p>What I basically want is to store <code>00:01:03.476</code> into a String. Is there any workaround or I am doing it wrong?</p>