title: How can I parse a date (provided as a string) in the "ddMM" format and convert it to a Date Object in Java?
body: <p>I am using the <code>SimpleDateFormatter</code> class to convert a string into a date. I have the following code which works for Feb 27, 2020:</p>
  
  <pre><code>SimpleDateFormat FORMATTER = new SimpleDateFormat("ddMM"); //always current year
  Date TODAY = FORMATTER.parse("2702");
  System.out.println(TODAY);
  </code></pre>
  
  <p>This resolves to the following date:</p>
  
  <pre><code>Fri Feb 27 00:00:00 UTC 1970
  </code></pre>
  
  <p>However, when I try the same for Feb 29, 2020 (a leap year), I get an error:</p>
  
  <p>Code:</p>
  
  <pre><code>SimpleDateFormat FORMATTER = new SimpleDateFormat("ddMM"); //always current year
  Date TODAY = FORMATTER.parse("2902");
  System.out.println(TODAY);
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Sun Mar 01 00:00:00 UTC 1970
  </code></pre>
  
  <p>Can someone please suggest a way so that I can take into account leap years as well, using this date format?</p>
  
  <p>Thank you.</p>