How to convert a String to Date of format yyyy-MM-dd HH:MM:ss
<p>I have a String like <code>"2015-07-16 17:07:21"</code> . I want to convert it into a Date of same format. I tried something like this:</p>

<pre><code>SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss");
Date date = sdf.parse("2015-07-16 17:07:21"); 
</code></pre>

<p>But output was different format like <code>Thu Jul 16 17:00:21 IST 2015</code>. How can I get it work as i need. can anyone help me. I know this might be a duplicate but i didn't find any luck.</p>