title: java string to utc date
body: <p>This question is a <em>duplicate</em> of <a href="https://stackoverflow.com/questions/7113357/java-parse-utc-time-string">this question</a> by intention. It seems like the older one is "ignored", while none of the answers there is the answer.</p>
  
  <p>I need to parse a given date with a given date pattern/format.</p>
  
  <p>I have this code, which is <em>supposed to</em> work:</p>
  
  <pre><code>import java.text.ParseException;
  import java.text.SimpleDateFormat;
  import java.util.Date;
  
  public class Main
  {
  
      public static void main(String[] args)
      {
          final Date date = string_to_date("EEE MMM dd HH:mm:ss zzz yyyy",
                  "Thu Aug 14 16:45:37 UTC 2011");
          System.out.println(date);
      }
  
      private static Date string_to_date(final String date_format,
              final String textual_date)
      {
          Date ret = null;
  
          final SimpleDateFormat date_formatter = new SimpleDateFormat(
                  date_format);
          try
          {
              ret = date_formatter.parse(textual_date);
          }
          catch (ParseException e)
          {
              e.printStackTrace();
          }
  
          return ret;
      }
  }
  </code></pre>
  
  <p>For some reason I'm getting this output:</p>
  
  <pre><code>java.text.ParseException: Unparseable date: "Thu Aug 14 16:45:37 UTC 2011"
      at java.text.DateFormat.parse(DateFormat.java:337)
      at Main.string_to_date(Main.java:24)
      at Main.main(Main.java:10)
  null
  </code></pre>
  
  <p>What's wrong with my date pattern? This seems to be a mystery.</p>