title: Joda Time parse a date with timezone and retain that timezone
body: <p>I want to parse a date, which was created with a specific timezone, convert it to a format and return it. The conversion works but the timezone offset is always set to +0000 with the time difference being added/subtracted as necessary. How can I get it to format and keep the offset correct?</p>
  
  <p>I expect this: 2012-11-30T12:08:56.23+07:00</p>
  
  <p>But get this: 2012-11-30T05:08:56.23+00:00</p>
  
  <p>Implementation:</p>
  
  <pre><code>public static final String ISO_8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSZZ";
  
  public static String formatDateToISO8601Standard(Date date) {
      DateTime dateTime = new DateTime(date);
      DateTimeFormatter df = DateTimeFormat.forPattern(ISO_8601_DATE_FORMAT);
      return dateTime.toString(df);
  }
  </code></pre>
  
  <p>Test class:</p>
  
  <pre><code>private static final String DATE_WITH_TIMEZONE = "30 11 2012 12:08:56.235 +0700";
  private static final String EXPECTED_DATE_WITH_TIMEZONE = "2012-11-30T12:08:56.23+07:00";
  
  @Test public void testFormattingDateWithSpecificTimezone() throws Exception {
      String result = JodaDateUtil.formatDateToISO8601Standard(createDate(DATE_WITH_TIMEZONE));
      assertEquals("The date was not converted correctly", EXPECTED_DATE_WITH_TIMEZONE, result); }
  
  private Date createDate(String dateToParse) throws ParseException {
      DateTimeFormatter df = DateTimeFormat.forPattern("dd MM yyyy HH:mm:ss.SSS Z");
      DateTime temp = df.parseDateTime(dateToParse);
      Date date = temp.toDate();
      return date; }
  </code></pre>