title: Convert specific BigInt to DateTime in T-SQL
body: <p>I have bigInt: <code>635307578922100000</code> which I need to convert to <code>DateTime</code>.</p>
  
  <p>I've tried few ways to do this:</p>
  
  <pre><code>SELECT 
      DATEADD(S, CONVERT(bigint,635307578922100000) / 1000, CONVERT(DATETIME, '1-1-1970 00:00:00')) 
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>SELECT 
      DATEADD(ms, 635307578922100000 / 86400000, (635307578922100000 / 86400000) +25567)
  </code></pre>
  
  <p>While I found the codes above work with <code>bigInts</code> like: <code>1283174502729</code>, with my bigInt I get the following error:</p>
  
  <blockquote>
    <p>Msg 8115 ...   Arithmetic overflow error converting expression to data
    type datetime.</p>
  </blockquote>
  
  <p>Does anyone have any idea how to solve it?</p>