Converting Java string to Date : <p>I need to convert a java string in a date format to a new date format to send it to my sql-server.  Currently, my Java date is <code>Jul 17 2018 14:22:58</code>, and I need it to look like <code>2018-07-17 14:22:58</code>.  So I created this:</p>

<pre><code>String oldTime = "Jul 17 2018 14:22:58";

SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-DD HH:MM:SS");
Date formattedDate = sdf.parse(oldTime);
</code></pre>

<p>I am getting errors that my oldTime is unparseable.  Did I do this wrong?</p>
