title: php mysql add 1 year to date then compare if that new date will come in 30 days
body: <p>I have been writing a small script that is supposed to check the expiration date 30 days prior to that date and send email reminder.</p>
  
  <p>I have a table with column named <code>'completed'</code> meaning the date when the course has been finished, completed. Each course is valid for 1 year.</p>
  
  <p>What I have been trying to do is first add one full year to '<code>completed</code>' then check if that new date falls exactly 30 days prior to <code>now().</code></p>
  
  <p>Example: the course was finished on 31 Dec 2012. It is valid until 31 Dec 2013, so if <code>TODAY</code> is 1 Dec 2013 email reminder should be sent.</p>
  
  <p>I have this little script:</p>
  
  <pre><code> SELECT distinct
       userID
       , completed+INTERVAL 1 YEAR AS expires
     FROM activity
    WHERE completed &gt; NOW() + INTERVAL 30 DAY
  </code></pre>
  
  <p>but obviously it doesn't do the job... 
  Could anyone point me into right direction?</p>
  
  <p>Thanks!
  Cheers,
  Greg</p>