title: Asp.net compare validator to validate date
body: <p>As you all know Compare validators can be used to validate dates and check based on operator type (&lt;, &lt;= , >= etc). I have set the <code>cultureinvariantvalues="true"</code> property to validate two textbox controls that hold dates. I have to constrain them such that the start date must be earlier than the finish date. The validation seems to fail when I type a descriptive date like below:</p>
  
  <pre><code>StartDate: Tuesday, 21 February 2012
  
  FinishDate: Wednesday, 22 February 2012
  </code></pre>
  
  <p>Even though 22nd is larger than 21st the validation fails. The markup I used is below. If for any reason you need format info, here it is <code>dddd, dd MMMM yyyy</code></p>
  
  <pre><code>&lt;asp:CompareValidator id="cvtxtStartDate" runat="server" 
         controltocompare="txtFinishDate" 
         cultureinvariantvalues="true" 
         display="Dynamic" 
         enableclientscript="true" 
         controltovalidate="txtStartDate" 
         errormessage="Start date must be earlier than finish date" 
         type="Date" 
         setfocusonerror="true" 
         operator="LessThanEqual" 
         text="Start date must be earlier than finish date"&gt;
  </code></pre>