Converting getdate() to yyyymmdd & getting the date two years back
<p>I have found a couple of different methods to convert it. However, I still get the <code>yyyy-mm-dd</code> format or <code>yyyy-mm-dd hh:mm:ss</code>. I am currently using SQL Server 2014.</p>

<pre><code>SELECT dateadd(day, convert(int, getdate()), 112)
SELECT DATEADD(YEAR, -2, convert(DATE, GETDATE(), 112))
</code></pre>

<p>I am doing a date range of 2 years. Thus I need the codes to the find the date two years back. </p>