title: Java/Android - Convert a GMT time string to local time
body: <p>Ok, so I have a string, say "Tue May 21 14:32:00 GMT 2012" I want to convert this string to local time in the format May 21, 2012 2:32 pm. I tried SimpleDateFormat("MM dd, yyyy hh:mm a").parse(), but it threw an exception. So what should I do?</p>
  
  <p>The exception is "unreported exception java.text.ParseException; must be caught or declared to be thrown."</p>
  
  <p>in the line <code>Date date = inputFormat.parse(inputText);</code></p>
  
  <p>The code I ran on TextMate:</p>
  
  <pre><code>public class test{
      public static void main(String arg[]) {
          String inputText = "Tue May 22 14:52:00 GMT 2012";
          SimpleDateFormat inputFormat = new SimpleDateFormat(
              "EEE MMM dd HH:mm:ss 'GMT' yyyy", Locale.US);
          inputFormat.setTimeZone(TimeZone.getTimeZone("Etc/UTC"));
          SimpleDateFormat out = new SimpleDateFormat("MMM dd, yyyy h:mm a");
          Date date = inputFormat.parse(inputText);
          String output = out.format(date);
         System.out.println(output);
      }
  }
  </code></pre>