title: System.FormatException: String was not recognized as a valid DateTime
body: <p>I am using c#.net. Thanks in advance for any help.</p>
  
  <p>I am using a Repeater and a ObjectDataSource. I use LINQ to connect to the database. This requires a parameter to be passed through (used within the WHERE clause)</p>
  
  <pre><code>    public IQueryable&lt;comments&gt; GetComments(DateTime todaysDate)
      {
          return (from c in dc.comments
                  where displayDate.Date == todayDate.Date
                  select c);
      }
  </code></pre>
  
  <p>I am encounting the error above and don't know why. Here is where the problem lies:</p>
  
  <pre><code>&lt;asp:Parameter DefaultValue="&lt;%=Convert.ToDateTime(DateTime.Now)%&gt;" Name="todayDate" Type="DateTime" /&gt;
  </code></pre>
  
  <p>If I provide a actual date it works. For example:</p>
  
  <pre><code>&lt;asp:Parameter DefaultValue="02/09/2009" Name="todayDate" Type="DateTime" /&gt;
  </code></pre>
  
  <p>I have also tried the following and recieved the same error:</p>
  
  <pre><code>DateTime.Now.Date
  Datetime.Now
  Datetime.Today
  Datetime.Now.ToString
  Datetime.Now.Date.ToString.
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks</p>
  
  <p>Clare</p>