title: Convert java.sql.Timestamp to java.sql.Timestamp in another timezone
body: <p>I am in need to manipulate on java.sql.Timestamp. </p>
  
  <p>Input to the function is: 
  Formatted DateTime in java.sql.Timestamp 
  [Possible date formats are: MM/dd/yyyy hh:mm:ss aa, MM/dd/yyyy hh:mm:ss, MM/dd/yyyy hh:mm aa, MM/dd/yyyy HH:mm, MM/dd/yy hh:mm aa, MM/dd/yy HH:mm, MM/dd/yyyy, and some others]</p>
  
  <p>Required Output: 
  java.sql.Timestamp in another Timezone the same formatted DateTime as input</p>
  
  <p>So basically I need to change timezone of the DateTime in java.sql.Timestamp </p>
  
  <p>I have seen other posts, which mention to use JODA, but I can't use it due to some restrictions. </p>
  
  <p>I have tried 
  - to convert java.sql.Timestamp to java.date.Calendar, 
  - then change the timezone,
  - then convert to it to date
  - format date to the same formatted datetime </p>
  
  <p>See the code below:</p>
  
  <pre><code>Timestamp ts = "2012-06-20 18:22:42.0";  // I get this type of value from another function
  Calendar cal = Calendar.getInstance();
  cal.setTime(ts);
  cal.add(Calendar.HOUR, -8);
  String string = cal.getTime().toString();     // return value is in " DAY MMM dd hh:mm:ss PDT yyyy " format i.e. Wed Jun 20 10:22:42 PDT 2012
  SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");  // This could be any format required
  Date date;
  try {
     date = formatter.parse(string);             // I am getting exception here on parsing 
  } catch (ParseException e1) {
     e1.printStackTrace();
  }
  </code></pre>
  
  <p>Can anyone tell me what is wrong here, or is there any other way to manipulate on Timezone for java.sql.Timestamp ? </p>
  
  <p>Thanks. </p>