title: How do I parse an RFC822 date in .NET?
body: <p>I have the following datetime string as returned to me by the Twitter API:</p>
  
  <blockquote>
    <p>"Thu Apr 26 11:38:36 +0000 2012"</p>
  </blockquote>
  
  <p>I need to convert this to a <code>DateTime</code> object so I call <code>ParseExact</code> with a custom format specifier:</p>
  
  <pre><code>CultureInfo provider = CultureInfo.InvariantCulture;
  DateTime publishDate = DateTime.ParseExact(tweet["created_at"].ToString(), "ddd MMM dd hh:mm:ss zzz yyyy", provider);
  </code></pre>
  
  <p>However, this raise a <code>FormatException</code> exception for any variant of <code>z</code>, <code>zz</code> or <code>zzz</code> for the time zone:</p>
  
  <blockquote>
    <p>String was not recognized as a valid DateTime.</p>
  </blockquote>
  
  <p>Looking at the <a href="http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx" rel="nofollow noreferrer">MSDN documentation</a> it's clear that that format specifier is expecting the time zone to be in the format <code>zz:zz</code> where there is a colon in the time zone to delimit the hours and minutes.</p>
  
  <p>I've checked other questions on Stack Overflow like:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/284775/how-do-i-parse-and-convert-datetimes-to-the-rfc-822-date-time-format">How do I parse and convert DateTime’s to the RFC 822 date-time format?</a></li>
  <li><a href="https://stackoverflow.com/questions/2985707/parsing-an-rfc822-datetime-in-netmf-4-0">Parsing an RFC822-Datetime in .NETMF 4.0</a></li>
  </ul>
  
  <p>and none of them really help.</p>
  
  <p>Is there a time zone specifier I can use that will correctly parse this format?</p>