title: C# HttpWebRequest Date Header Formatting
body: <p>I'm making a HttpWebRequest to S3, and I'm trying to set the Date header to something like this:</p>
  
  <blockquote>
    <p>"Mon, 16 Jul 2012 01:16:18 -0000"</p>
  </blockquote>
  
  <p>Here is what I've tried: </p>
  
  <pre><code>string pattern = "ddd, dd MMM yyyy HH:mm:ss -0000";
  request.Date = DateTime.ParseExact("Mon, 16 Jul 2012 01:16:18 -0000", pattern, null);
  </code></pre>
  
  <p>But, when I look at the headers of the request, here's what I get:</p>
  
  <pre><code>request.Headers.Get("Date");
  // "Mon, 16 Jul 2012 07:16:18 GMT"
  </code></pre>
  
  <p>I believe this may the reason for a 403 on the request. The AWS error docs mention:</p>
  
  <blockquote>
    <p>403 Forbidden - The difference between the request time and the
    server's time is too large.</p>
  </blockquote>
  
  <p>Any suggestions for getting this date sorted out would be greatly appreciated. Thanks!</p>