title: Conversion to java.sql.Date
body: <p>I have a <code>String</code> as below which needs to be converted into <code>java.sql.Date</code> format:</p>
  
  <p><code>2017-08-31 01:40:00+00:00</code></p>
  
  <p>I am using below code and I can see date is only parsed as <code>2017-08-31</code> and not the entire string as above. Can someone please suggest?</p>
  
  <pre><code>java.util.Date utilDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(dateTimeStamp);
  
  java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
  </code></pre>
  
  <p>Based on the suggestion in the answers, I implemented below:</p>
  
  <pre><code>String dateTimeStamp = "2017-08-31 01:40:00+00:00";
  java.text.DateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd hh:mm:ssZZ");
  java.util.Date date = format.parse(dateTimeStamp);
  java.sql.Timestamp timestamp = new java.sql.Timestamp(date.getTime());
  System.out.println("timestamp - " + timestamp);
  </code></pre>
  
  <p>But, am getting below error:</p>
  
  <pre><code>java.text.ParseException: Unparseable date: "2017-08-31 01:40:00+00:00"
          at java.text.DateFormat.parse(DateFormat.java:366)
          at com.eneco.mysqlsink.WeatherForecastSink.WeatherForecastTask.put(WeatherForecastTask.java:94)
          at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:435)
          at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:251)
          at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:180)
          at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:148)
          at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:146)
          at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:190)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
  </code></pre>