title: Converting string to java.util.date
body: <p>I am trying to convert string in java.util.date but I am having following errors:</p>
  
  <pre><code> HelloWorld.java:10: error: incompatible types: Date cannot be converted to    String                                                                                                                                                                       
          return FORMATTER.parse(date);                                                                                                                                                                                                               
                                ^                                                                                                                                                                                                                     
   HelloWorld.java:16: error: incompatible types: String cannot be converted to Date                                                                                                                                                                       
      Date date = convertStringToDate("2015-08-03 09:19:00.000");    
  </code></pre>
  
  <p>My code is below:</p>
  
  <pre><code>import java.text.SimpleDateFormat;
  import java.util.Date;
  
  public class HelloWorld{
  
  private static final SimpleDateFormat FORMATTER = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
  
   public static String convertStringToDate(String date) {
      if(date!=null){
          return FORMATTER.parse(date);
      }
      return null;
  }
  
   public static void main(String []args){
      Date date = convertStringToDate("2015-08-03 09:19:00.000");
      System.out.println(date);
   }
  }
  </code></pre>