title: T-SQL query to get a date +30 days from today exactly
body: <p>Data is in date/time format and I'm trying to get list of rows where the date is exatly in 30 days from today. This is based on SQL Server 2005. </p>
  
  <p>So on 1st of July, I would get a list of rows where the date is 1st of August. </p>
  
  <p>Example entry would be: </p>
  
  <blockquote>
    <p>Sunday, July 04, 1993 12:00 AM</p>
  </blockquote>
  
  <p>However my query doesn't seem to return any rows at all for some reason.</p>
  
  <pre><code>AND DATEPART("month", a.PersonBirthdate) = DATEPART("month", GetDate())
  AND DATEPART("day", a.PersonBirthdate) = DATEPART("day", GetDate()+30)
  </code></pre>
  
  <p>For an example, the below query part works fine to get list of rows where the date is today:</p>
  
  <pre><code>AND DATEPART("month", a.PersonBirthdate) = DATEPART("month", GetDate())
  AND DATEPART("day", a.PersonBirthdate) = DATEPART("day", GetDate())
  </code></pre>