title: converting date to string and back to date in java
body: <p>In my program I am trying to convert the date to string to specified format and then back to date. I need the date to be in dd-MMM-yy format. So, I am converting the date to dd-MMM-yy format using SimpleDateFormat like,</p>
  
  <pre><code>SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yy");
  String bookingDate = sdf.format(myDate);
  </code></pre>
  
  <p>The result is what I expected, that is 23-May-12 but when I convert the string back to date 
  using parse(), it is changing to Wed May 23 13:16:14 IST 2012. </p>
  
  <p>Is there any way to convert the string back to date without changing format? I strictly need to pass the date object in the specified format to the query.</p>