title: How to search birthdays dates using only day and month
body: <p>I've been looking for a solution here in the community, but I have not found anything specific. I need to do searches for birthdays among a period using only the month and month day (excluding year). I have users with their birthdays registered in date fields in my MySQL. </p>
  
  <p><strong><code>Name      |  Dt. Birth</code></strong><br>
  <code>Julian    | 1990/01/18</code><br>
  <code>Luiz      | 2000/02/15</code><br>
  <code>Morgana   | 1973/02/01</code><br></p>
  
  <p>I need to realize two different tasks.</p>
  
  <blockquote>
    <p><strong>1st</strong> - Let's suppose today date is February 01. How could I take today's date and decrease 14 days, searching for users whose birthday was on previous 2 weeks? (only Julian would be listed). <br><br>
    Another query will list users whose birthday is today (only Morgana would be listed). <br><br>
    And a third one should list the birthdays within next two weeks (only Luiz would be listed) 
    I was using these code, but they don't seem to work at all times.<br></p>
  </blockquote>
  
  <pre><code>select * from user where DAYOFYEAR(dateBirth) between DAYOFYEAR(CURDATE())-14 and DAYOFYEAR(CURDATE())-1;
  select * from user where DAYOFYEAR(dateBirth) = DAYOFYEAR(CURDATE());
  select * from user where DAYOFYEAR(dateBirth) between DAYOFYEAR(CURDATE())+1 and DAYOFYEAR(CURDATE())+14;
  </code></pre>
  
  <p><br></p>
  
  <blockquote>
    <p><strong>2nd</strong> - In a form, I will select two days and months<br>  <code>|01||January |</code><br><code>|15||February|</code><br>and the users whose birthday is within this range will be listed. (All users listed) </p>
  </blockquote>
  
  <p>Maybe this fiddle help you visualize the question. <a href="http://www.sqlfiddle.com/#!9/1dec7a/5" rel="nofollow noreferrer">http://www.sqlfiddle.com/#!9/1dec7a/5</a>
  <br>I reproduce the above queries that show some inaccuracy. If you change values (-14/+14 and (-1/+1), you shall be able to list the users. </p>