title: Unable to convert String to Date by requestBody in spring
body: <p>I have the below Code :</p>
  
  <p><strong>DTO :</strong></p>
  
  <pre><code> Class MyDTO {
          import java.util.Date;
          private Date dateOfBirth;
  
          public Date getDateOfBirth() {
                  return dateOfBirth;
              }
          public void setDateOfBirth(Date dateOfBirth) {
                  this.dateOfBirth = dateOfBirth;
              }
  
      }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public void saveDOB(@RequestBody MyDTO myDTO, HttpServletRequest httprequest, HttpServletResponse httpResponse) {
         System.out.println("Inside Controller");
         System.out.println(myDTO.getDateOfBirth()); 
  }
  </code></pre>
  
  <p><strong>JSON Request :</strong></p>
  
  <pre><code>{
  "dateOfBirth":"2014-09-04",
  
  }
  </code></pre>
  
  <p><strong>If I send the request as yyyy-mm-dd automatic conversion to date object happens.</strong>
  <strong>output in controller:-</strong>
  dateOfBirth= Thu Sep 04 05:30:00 IST 2014</p>
  
  <p><strong>But when I send DateofBirth in dd-mm-yyyy format It does not convert String to Date automatically.So how i can i handle this case.</strong></p>
  
  <p><strong>JSON Request :</strong></p>
  
  <pre><code>{
  "dateOfBirth":"04-09-2014",
  
  }
  </code></pre>
  
  <p><strong>Output:</strong> No Output in console does not even reaches controller.</p>
  
  <p>I have tried with @DateTimeFormat but its not working.</p>
  
  <p>I am using Spring 4.02 Please suggest is there any annotation we can use.</p>