title: How to know whether a given string is a valid UTC DateTime format?
body: <p>I'd need to allow accepting UTC datetimes: <a href="http://www.w3.org/TR/NOTE-datetime" rel="nofollow">http://www.w3.org/TR/NOTE-datetime</a></p>
  
  <p>Such as:</p>
  
  <pre><code> - Year:
           YYYY (eg 1997)    Year and month:
           YYYY-MM (eg 1997-07)    Complete date:
           YYYY-MM-DD (eg 1997-07-16)    Complete date plus hours and minutes:
           YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)    Complete date plus hours, minutes and seconds:
           YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)    Complete date plus hours, minutes, seconds and a decimal fraction of
     a second
           YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00) where:
  
          YYYY = four-digit year
          MM   = two-digit month (01=January, etc.)
          DD   = two-digit day of month (01 through 31)
          hh   = two digits of hour (00 through 23) (am/pm NOT allowed)
          mm   = two digits of minute (00 through 59)
          ss   = two digits of second (00 through 59)
          s    = one or more digits representing a decimal fraction of a second
          TZD  = time zone designator (Z or +hh:mm or -hh:mm)
  </code></pre>
  
  <p>How to Convert a string to a DateTime with a specific format?</p>
  
  <p>I wrote the below code:</p>
  
  <pre><code> private const string Format = "YYYY-MM-DDThh:mm:ssZ";
  
          public DateTime? Parse(string modifiedSince)
          {
              // how to know whether it's a valid DateTime in UTC format?
          }
  </code></pre>
  
  <p>But it always returns null which means that it fails to parse to DateTime.</p>
  
  <p>It should successfully validate below UTC values but it doesn't:</p>
  
  <pre><code>2013-05-10
  2013-05-10T05:04:10
  2013-05-10T05:04:10.40
  013-05-10T05:04:10.4Z
  </code></pre>
  
  <p>(Z is optional usually)</p>
  
  <p>How to use DateTime.Parse or .Parsexact so that it successfully returns a date for the above format?</p>
  
  <p>All other date formats should fail e.g. 20130510</p>
  
  <p>I could write a Regex instead?</p>