title: Java: unparseable date exception
body: <p>While trying to transform the date format I get an exception:unparseable date and don't know how to fix this problem. </p>
  
  <p>I am receiving a string which represents an event date and would like to display this date in different format in GUI.</p>
  
  <p>What I was trying to do is the following:</p>
  
  <pre><code>private String modifyDateLayout(String inputDate){
          try {
              //inputDate = "2010-01-04 01:32:27 UTC";
              Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z").parse(inputDate);
              return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(date);
          } catch (ParseException e) {
              e.printStackTrace();
              return "15.01.2010";
          }
      }
  </code></pre>
  
  <p>Anyway the line</p>
  
  <pre><code>String modifiedDateString = originalDate.toString();
  </code></pre>
  
  <p>is dummy. I would like to get a date string in the following format:</p>
  
  <blockquote>
    <p>dd.MM.yyyy HH:mm:ss</p>
  </blockquote>
  
  <p>and the input String example is the following:</p>
  
  <blockquote>
    <p>2010-01-04 01:32:27 UTC</p>
  </blockquote>
  
  <p>Does anyone know how to convert the example date (String) above into a String format dd.MM.yyyy HH:mm:ss?</p>
  
  <p>Thank you!</p>
  
  <p>Edit: I fixed the wrong input date format but still it doesn't work. Above is the pasted method and below is the screen image from debugging session.</p>
  
  <p><a href="http://img683.imageshack.us/img683/193/dateproblem.png">alt text http://img683.imageshack.us/img683/193/dateproblem.png</a></p>
  
  <p><strong>#Update</strong>
  I ran </p>
  
  <pre><code>String[] timezones = TimeZone.getAvailableIDs();
  </code></pre>
  
  <p>and there is UTC String in the array. It's a strange problem. </p>
  
  <p>I did a dirty hack that works:</p>
  
  <pre><code>private String modifyDateLayout(String inputDate){
      try {
          inputDate = inputDate.replace(" UTC", "");
          Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(inputDate);
          return new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(date);
      } catch (ParseException e) {
          e.printStackTrace();
          return "15.01.2010";
      }
  }
  </code></pre>
  
  <p>But still I would prefer to transform the original input without cutting timezone away.</p>
  
  <p>This code is written for Android phone using JDK 1.6.</p>