title: Oracle to SQL Server: Date Conversion & Format
body: <p>I'm in the process of migrating our Data Warehouse from Oracle to SQL Server 2012.</p>
  
  <p>One piece of code I use a hundred times a day in Oracle is changing the date format for a query by using something like: </p>
  
  <pre><code>To_Char(entry_date,'WMMYY') = 30612 
  </code></pre>
  
  <p>The above allows me to grab the date (default format = <code>DD-MON-YY</code> eg <code>01-JAN-12</code>) and change the format for the week specified (the third week of June in the above example) by simply listing the week desired.</p>
  
  <p>In my mind the above is very simple and easy to use. I can change it to whatever format I want (MMYY, MMYYYY) etc. without any issues. So far I cannot figure out an easy way to do this in SQL Server 2012 and it's really starting to bother me. It's <code>datetime2</code> in SQL Server.</p>
  
  <p>I'm finding stuff for <code>CAST(), CONVERT(), DATEPART()</code> but from what I've seen there is all kinds of wacky coding and number codes (like 101, 102, I don't understand why this is) required which just seems extraneous and over complicated to me.</p>
  
  <p>Have I just not found what I'm looking for yet or is this just the way it is with SQL Server? I just want to be able to do something simple like grab all the data that was entered in during the month of june or the second week of october without having to add 200 extra characters of code.</p>