title: Filter Date and Time in MS SQL Server used for Date Range filter
body: <p>What is the correct Date Format should I use in MS SQL Server if I have this kind of scenario?</p>
  
  <pre><code>--This values here will be supplied by a datetimepicker Control
  @StartDate = '05/15/2013 10:00 PM' 
  @EndDate = '05/16/2013 06:00 AM'
  
  SELECT * 
  FROM tblSomething 
  WHERE TransDate &gt;= @StartDate AND TransDate &lt;= @EndDate
  </code></pre>
  
  <p>How can I format the TransDate field?</p>
  
  <p>Is this Correct? </p>
  
  <pre><code>Declare @StartDate as datetime
  Declare @EndDate as datetime
  
  set @StartDate = '05/15/2013 10:00 PM'
  set @EndDate = '05/16/2013 06:00 AM'
  
  
  Select * from tblSomething Where convert(varchar(20),TransDate,100) &gt;= convert(varchar(20),@StartDate,100) and convert(varchar(20),TransDate,100) &lt;= convert(varchar(20),@EndDate,100) 
  </code></pre>
  
  <p>The reason AM/PM is important to me is because we have employees that have transactions that starts 10PM in the evening and ends at 6am the next morning. I need to extract the transactions of that employee with that time frame.</p>