title: DateTime Format yyyymm
body: <p>I've found every DateTime format you can think of except the one I need: yyyymm.  How do I go about getting this?</p>
  
  <p>I have the following code I'm working with:</p>
  
  <pre><code>List &lt;string&gt; routines = new List&lt;string&gt;();
  routines.Add("1 - Routine");
  routines.Add("6 - Planned Outage");
  
  int year = 2011;
  int quarter = 1;
  
  DateTime timeframe = new DateTime(year, (quarter * 3), 01).AddMonths(1); 
  
  var results =
  
      (from wo in WORKORDERs
  
          join wot in WORKORDERTYPEs on wo.Wot_oi equals wot.Wotyoi
  
          join pri in PRIORITies on wo.Prio_oi equals pri.Priooi
  
          join s in SITEs on wo.BEparn_oi equals s.Siteoi
  
      where wo.Audt_created_dttm.Value.Year &gt;= year - 3 &amp;&amp; wo.Audt_created_dttm.Value.Year &gt;= 2006
          &amp;&amp; wo.Audt_created_dttm &lt; timeframe &amp;&amp; (s.Id =="NM" || s.Id == "TH") &amp;&amp; 
          !wot.Id.Contains("stand") &amp;&amp;  !(wo.Ci_cnc_date != null &amp;&amp; pri.Prioid != "1 - Routine" &amp;&amp;
          pri.Prioid != "6 - Planned Outage") &amp;&amp; (SqlMethods.Like(pri.Prioid, "1%") || 
          SqlMethods.Like(pri.Prioid, "2%") || SqlMethods.Like(pri.Prioid, "3%"))     
  
      select new {PM = wo.Wosource, Site = s.Id, Priority = pri.Prioid, Worktype = wot.Id,
          WoNumber = wo.Id, Description = wo.Aenm, CreateDate = wo.Audt_created_dttm,
          CloseDate = wo.Clsdt_date,
          MonthNum = String.Format("{0:yyyy mm}",  wo.Clsdt_date), 
          Planning = routines.Contains(pri.Prioid) ? "Planned" : "Unplanned"});
  </code></pre>
  
  <p>I tried using: </p>
  
  <pre><code>MonthNum = String.Format("{0:yyyy mm}",  wo.Clsdt_date) 
  </code></pre>
  
  <p>and that gives me the year correctly but the months are all 00.  I'm guessing this is because the format for wo.Clsdt_date is different than my string format (it's mm/dd/yyyy).</p>
  
  <p>Any ideas?</p>