title: Conversion of String to Date - Unparseable date: "03/26/2012"
body: <p>I'm experimenting on a Java Program that makes use of Jasper Reports. What started out as a (supposedly) simple "arrange the dates in descending order" task for the Report became more complex when I found out that the 'dates' were in String format, and thus, were being sorted, albeit in a wrong manner. Example:</p>
  
  <ul>
  <li>03/26/12 </li>
  <li>03/26/12 </li>
  <li>08/11/12 </li>
  <li>08/26/12 </li>
  <li>10/26/11</li>
  </ul>
  
  <p>I can only guess that the 10/26/11 is placed on the bottom simply because of the 10 in front.</p>
  
  <p>I've looked into the Jasper Report using iReport 3.0.0, and I've found the following:</p>
  
  <ul>
  <li>The date in question (named: DTEEFFEC), under Fields, is set to String.</li>
  <li>The textField is also set to String.</li>
  </ul>
  
  <p>This doesn't produce any errors, it only makes it difficult, if not impossible, to arrange the 'dates' in descending order.</p>
  
  <p>So I've done the following:</p>
  
  <ul>
  <li>Left DTEEFFEC as is (String).</li>
  <li>Changed the textField from Java.Lang.String to Java.Util.Date</li>
  <li><p>Added the following to the New Field Expression:</p>
  
  <p>new SimpleDateFormat("MM-dd-yyyy").parse($F{DTEEFFEC}.toString())</p></li>
  </ul>
  
  <p>I found out that bit of code after some research on my problem. A lot of the responses were along the lines of "it worked", but not so for me.</p>
  
  <pre><code>Caused by: java.text.ParseException: Unparseable date: "03/26/2012"
  </code></pre>
  
  <p>That is what the Java program returns. I've tried tinkering with both the field and the textField (alternating between either String or Date values), but it gives me other errors entirely.</p>
  
  <p>Can I have some help on this?</p>
  
  <p>Thanks.</p>
  
  <p>Other information: I'm using iReports 3.0.0 to modify the JRXML file, and Eclipse for the Java Program. If the Referenced Libraries under Eclipse is to be believed, I'm using JasperReports 3.5.2. The entire thing runs on Windows 7.</p>