title: How to convert time interval from PostgreSQL in java
body: <p>I want to select the <code>time_interval</code> column which is of type <code>interval</code> from PostgreSQL.</p>
  
  <p>and convert to long type with Java code </p>
  
  <p>my table is</p>
  
  <pre><code>  trigger
    id   time_interval  cdate 
    1     01:00:00      2018-12-11
    2     1 day         2018-12-11
    3     1 month       2018-12-11
    4     00:05:00      2018-12-11
  </code></pre>
  
  <p>The Java code is</p>
  
  <pre><code>   List&lt;Long&gt; results= executeQuery("select * from trigger limit 10",(rs,rowNum)-&gt;{
  
          Long time_interval = rs.getTimestamp("time_interval").getTime();
  
          return time_interval ;
  
      });
  </code></pre>
  
  <p>My error is</p>
  
  <pre><code>nested exception is
  org.postgresql.util.PSQLException: Bad value for type timestamp/date/time: {1}
  </code></pre>