java.text.ParseException while converting string to date
<p>I am a very beginner to java. I am new to this site.</p>

<p>I am trying to convert a string to date but i am getting parse exception.
Below is my code:
    I have the value in my variable myDateValue as <code>Wed May 15 00:00:00 IST 2013</code></p>

<pre><code>DateFormat sdf1 = new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH);
java.util.Date myDate = sdf1.parse(myDateValue);
java.sql.sqlDate = new java.sql.Date(myDate.getTime());
</code></pre>

<p>I get the below exception:</p>

<blockquote>
  <p>java.text.ParseException: Unparseable date: "Wed May 15 00:00:00 IST
  2013"</p>
</blockquote>

<p>I also tried this but also it not worked:</p>

<pre><code>DateFormat sdf1 = new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH);
String formatdate = sdf1.format(myDateValue);
java.util.Date myate = sdf1.parse(formatdate);
java.sql.sqlDate = new java.sql.Date(myate.getTime());
</code></pre>

<p>For this i got the below error:</p>

<blockquote>
  <p>java.lang.IllegalArgumentException: Cannot format given Object as a
  Date</p>
</blockquote>

<p>What am i doing wrong?</p>