title: Converting String Format Date for Date Object
body: <p>I am getting a Date format in String as Output like this. </p>
  
  <blockquote>
    <p>Fri May 18 00:00:00 EDT 2012</p>
  </blockquote>
  
  <p>I need to Convert this to a Date Object. What approach shall I use?</p>
  
  <p>Thank you.</p>
  
  <p>This is the program i used.</p>
  
  <pre><code>import java.util.*;
  import java.text.*;
  
  public class DateToString {
      public static void main(String[] args) {
          try {
              DateFormat formatter ;
              Date date ;
              formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss 'EDT' yyyy ");
              date = (Date)formatter.parse("Fri May 18 00:00:00 EDT 2012");
              String s = formatter.format(date);
              System.out.println("Today is " + s);
          } catch (ParseException e) {
              System.out.println("Exception :"+e); 
          }
      }
  }
  </code></pre>