title: Select between dates, but ignoring year. Problems when filtering over year end
body: <p>I have a table with birthdays:</p>
  <pre><code>CREATE TABLE birthdays
      (`name` varchar(10), `day` datetime)
  ;
      
  INSERT INTO birthdays
      (`name`, `day`)
  VALUES
      ('Joe', '2000-03-18'),
      ('Mike', '2000-12-23'),
      ('Albert', '2000-02-15');
  </code></pre>
  <p>I want to find all person with birthday inside a given interval. It works fine, when my two dates are in the same year:</p>
  <pre><code>SELECT * 
  FROM birthdays 
  WHERE DATE_FORMAT(day, &quot;%m-%d&quot;) BETWEEN DATE_FORMAT('2021-12-01',&quot;%m-%d&quot;) AND DATE_FORMAT('2021-12-31',&quot;%m-%d&quot;);
  </code></pre>
  <p>But the moment I filter between two dates over year end, I get nothing. I tried two approaches: DATE_FORMAR and DAYOFYEAR, with the same result:</p>
  <pre><code>SELECT * 
  FROM birthdays 
  WHERE DATE_FORMAT(day, &quot;%m-%d&quot;) BETWEEN DATE_FORMAT('2021-11-28',&quot;%m-%d&quot;) AND DATE_FORMAT('2022-01-01',&quot;%m-%d&quot;);
  
  SELECT * 
  FROM birthdays
  WHERE DAYOFYEAR(day) BETWEEN DAYOFYEAR('2021-11-28') AND DAYOFYEAR('2022-01-01')
  </code></pre>
  <p>Here is a <a href="http://sqlfiddle.com/#!9/cdb0bb/5" rel="nofollow noreferrer">SQL Fiddle</a> with the problem.</p>