title: C# date formats for SQL Server
body: <p>I have dates in SQL stored as DateTime,
  when showing them in a textbox I do this:</p>
  
  <pre><code>txtDateLogged.Text = v.DateLogged.ToString("dd-MM-yyyy");
  </code></pre>
  
  <p>But when I the update that textbox to write back to SQL Im getting and invalid DateTime error when using this:</p>
  
  <pre><code>if (DateLogged!= "")
  { 
       uInput.DateLogged = Convert.ToDateTime(DateLogged);
  }
  </code></pre>
  
  <p>Im assuming Im missing something in the formatting - the date value is passed into the public void doing the update as a string, then converted in the line above.
  Any suggestions?</p>
  
  <p>thanks</p>
  
  <p>T</p>