title: How to set value on varchar to datetime variable
body: <p>I have two variables, one is <code>varchar</code> another one is <code>datetime</code>. I need to convert <code>varchar</code> to <code>datetime</code></p>
  
  <pre><code>declare @startdate as varchar(10)= '1/1/2013 1:60AM'
  declare @enddate as varchar(10)= '1/1/2014 1:60AM'
  declare @startdTime datetime
  
  set @ startdTime =cast(@startdate as datetime)
  </code></pre>
  
  <p>This conversion however causes an error:</p>
  
  <blockquote>
    <p>The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. </p>
  </blockquote>
  
  <p>How to convert this without error? I see several example on <a href="https://stackoverflow.com/questions/12862003/how-convert-string-variable-to-datetime-variable-in-sql-server">stackoverflow</a> but fail to get solution,need help on this issue.</p>
  
  <p>IF have any query please ask, thanks in advance</p>