title: Preserving format while passing DateTime values to Stored Procedure
body: <p>I have a TextBox server control on a Web Form, say, <em>txtDueDate</em>. I don't want to use DateTimePicker but want to use TextBox itself. The user enters date in dd/mm/yyyy format.</p>
  
  <p>While passing this value to SQL Server 2005 (Express) stored procedure, I use something like:</p>
  
  <pre><code>cmdParameters.AddWithValue("@DueDate", Convert.ToDateTime(txtDueDate.Text));
  </code></pre>
  
  <p>The stored procedure has input parameter to handle this value and is declared as:</p>
  
  <pre><code>@DueDate SmallDateTime
  </code></pre>
  
  <p>I want to know the default format SQL Server 2005 uses internally to store this date. On my PC, the Windows XP Regional Settings are set to dd/mm/yyyy format. While viewing records through Management Studio, it is stored correctly. But I am worried about users who will be using this web application. The Windows Regional Settings may differ on their PC.</p>
  
  <p>I want to be sure whoever queries the database, the date is displayed in dd/mm/yyyy format. If someone inserts, 02/01/2004, then it <strong>should not become</strong> a valid reverse date like: 01/02/2004.</p>