title: Java ora-01830 date format picture ends before converting entire input string Timestamp SQL
body: <p>I'm having problems getting dates from my database while using Oracle through java. If I use this in Java: </p>
  
  <pre><code>SELECT * 
  from HA2_BOOKINGS 
  WHERE ROOM like 'R1' 
    AND BEGINNING &gt;= (TO_TIMESTAMP('2018-06-11 15:11:43.208', 'YYYY-MM-DD HH24:MI:SSXFF')) 
    AND END &lt;=  (TO_TIMESTAMP('2018-06-11 15:11:43.208', 'YYYY-MM-DD HH24:MI:SSXFF'))
  </code></pre>
  
  <p>I get the ora-01830 error but when I use the exact same thing in oracle itself the code works. Does anyone know why?</p>
  
  <p>My java code:</p>
  
  <pre><code>public Collection&lt;Booking&gt; getAllBookingsForRoomInPeriod(Room r, String startDate, String endDate) {
          Collection&lt;Booking&gt; bookingsForRoomInPeriod = new ArrayList&lt;Booking&gt;();
          SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd HH:mm");
          parser.setLenient(false);
  
          Date dateBeginning = new Date();
          Date dateEnd = new Date();
          try {
              dateBeginning = parser.parse(startDate);
          } catch (ParseException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          try {
              dateEnd = parser.parse(endDate);
          } catch (ParseException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
          Timestamp tsBeginning = new Timestamp(dateBeginning.getTime());
          Timestamp tsEnd = new Timestamp(dateEnd.getTime());
  
          bookingList.clear();
  
          Connection aCon = Persistence.getConnection();
          ResultSet resultSet = null;
  
          // Raeume lesen
          try {
              resultSet = Persistence.executeQueryStatement(aCon, "SELECT * from HA2_BOOKINGS WHERE ROOM like '" + r.getRoomNr() + "' AND BEGINNING &gt;= (TO_TIMESTAMP('" + tsBeginning + "', 'YYYY-MM-DD HH24:MI')) AND END &lt;=  (TO_TIMESTAMP('" + tsEnd + "', 'YYYY-MM-DD HH24:MI'))");
              while (resultSet.next()) {
                  Booking a = new Booking();
                  a.setRoom(resultSet.getString("ROOM"));
                  a.setUsername(resultSet.getString("USERNAME"));
                  a.setDescription(resultSet.getString("DESCRIPTION"));
                  a.setBeginning(resultSet.getTimestamp("BEGINNING"));
                  a.setEnd(resultSet.getTimestamp("END"));
                  this.bookingList.add(a);
              }
          } catch (SQLException e) {
              e.printStackTrace();
          } finally {
              Persistence.closeConnection(aCon);
          }
          System.out.println(bookingList);
  
          return bookingList;
  }
  </code></pre>