title: converting timezone back to local
body: <p>I'm stuck converting the Date object back to a local timezone. I've googled a lot and couldn't arrive at a solution.</p>
  
  <p>My scenario is: I send a request (with full date string in local timezone 04/01/2014T00:00:00+0530) to a web server which is located in some other timezone than that of mine. The server appropriately converts it to UTC and does some manipulation and sends a CSV file back. I've a date column in CSV which is always in GMT.</p>
  
  <pre><code>String input = "04/01/2014T00:00:00+0530";
  DateFormat inputDateFormat = new SimpleDateFormat("MM/dd/yyyy'T'HH:mm:ssZ");
  DateFormat csvFileDateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm z");
  
  Date inputDate = inputDateFormat.parse(input); // Mon Mar 31 18:30:00 GMT 2014
  // inputDateFormat.getTimeZone(); // is always GMT
  
  // After some processing I create CSV file
  // within a loop
  Date csvDate = // got Date from some operation, for simplicity I removed the code.
  csvFileDateFormat.format(csvDate); // **HERE IS THE ISSUE**
  // end of loop
  </code></pre>
  
  <p>I wanted to set the timezone of csvFileDateFormat correctly. Below code works, but I don't want to hard code "GMT+05:30". Instead need to extract the timezone only from input string.</p>
  
  <pre><code>csvFileDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+05:30")); // I dont want to hard code
  </code></pre>
  
  <p>Any help is highly appreciated. 
  PS: I don't have option to use any other libraries, like joda, etc...</p>
  
  <p>Regards
  ArunDhaJ</p>