title: parse string into date format
body: <p>I am importing data from a csv file via opencsv to insert into a mysql DB. opencsv imports as string and for 1 field in the DB I need to parse it to date in the format: yyyy-MM-dd. However I am getting an error. </p>
  
  <pre><code>// This is the string that I have extracted from the csv file           
  String elem1 = nextLine[0];
  
  // printing out to console I can see the string I wish to convert
  System.out.println(elem1); =&gt; 2015-08-14
  
  // Below is my code to parse the date
  
  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  java.util.Date convertedCurrentDate = sdf.parse(elem1);
  String date=sdf.format(convertedCurrentDate );
  
  // printing date to console gives me 2015-08-14
  System.out.println(date);
  </code></pre>
  
  <p>As mentioned above printing date out to console gives me 2015-08-14. However I get the error: </p>
  
  <pre><code>java.text.ParseException: Unparseable date: "" 
  </code></pre>
  
  <p>Can someone give me some advice as to what I am doing wrong?</p>
  
  <p>The line 'java.util.Date convertedCurrentDate = sdf.parse(elem1);' is the line causing the error. </p>
  
  <p>Thanks!</p>