title: Parse date exact in c# with variable year length
body: <p>I'm trying to find the appropriate format string to parse (exact) the following types of dates:</p>
  
  <ul>
  <li><code>1-01-01T00:00:00+00:00</code> - 1 January of 0001</li>
  <li><code>2011-12-14T15:53:40+00:00</code> - 14 December of 2011</li>
  </ul>
  
  <p>So the year length seems to be variable (1-4 characters).</p>
  
  <p>The format sting I currently use to parse exact is:<br>
  <code>c_DateTimeFormatString = "yyyy-MM-ddTHH':'mm':'sszzz"</code></p>
  
  <p>Obviously this only matches the second string. The first one poped up today. Now we have to match that as well.</p>
  
  <p>Is there a format string to achieve this?</p>
  
  <p><em><strong>UPDATE #1</em></strong><br>
  I added the actual dates in clear text after the input date strings.</p>
  
  <p><em><strong>UPDATE #2</em></strong><br>
  Parse exact has an overload that allows for multiple format strings to be passed in. This seems to be the right way.  </p>
  
  <p>So the first try was to use:</p>
  
  <p><code>DateTime.ParseExact("1-01-01T00:00:00+00:00 ", new[] { "yyyy-MM-ddTHH':'mm':'sszzz", "yyy-MM-ddTHH':'mm':'sszzz", "yy-MM-ddTHH':'mm':'sszzz", "y-MM-ddTHH':'mm':'sszzz" }, CultureInfo.CreateSpecificCulture("en-US"), DateTimeStyles.AssumeLocal)</code></p>
  
  <p>But sadly this does ont give the correct result, the first date string is parsed as:<br>
  <code>01.01.2001</code><br>
  rather than<br>
  <code>01.01.0001</code></p>
  
  <p>So the question now is what is the correct parsing string to parse year one which is represented with only one digit?</p>