title: How to convert date saved in String format to Date format
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2600581/dateformat-conversion-problem-in-java">DateFormat conversion problem in java?</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying to convert string to date, but getting error.</p>
  
  <p>I am getting date using :</p>
  
  <pre><code>URL xmlUrl = new URL(path);
  URLConnection urlconn = xmlUrl.openConnection();
  Date =  new Date(urlconn.getLastModified());
  </code></pre>
  
  <p>and then I ma saving this date in a file , which saves in the following format : </p>
  
  <pre><code>Mon Jun 21 16:31:24 Asia/Karachi 2010
  </code></pre>
  
  <p>and then when later I read this date from file as a String, I again want to save it to a Date, but I am getting error.</p>
  
  <p>I tried :</p>
  
  <pre><code>DateFormat format = DateFormat.getDateInstance();
  date =  format.parse(fileDate);
  </code></pre>
  
  <p>but I am getting error :</p>
  
  <pre><code>java.text.ParseException: Unparseable date: Mon Jun 21 16:31:24 Asia/Karachi 2010
  </code></pre>
  
  <p>Is there any way i can retrieve back the date.</p>
  
  <p>Thanks</p>