title: Convert DateTime To A whole number no decimal int
body: <p>I am close, I just can't quite figure out how to only get a whole number, and drop the '0' (short of just using Left 1 to capture the number.  However, I am sure that is atrocious syntax to do such.  This is what I have so far.  How could I just get an 8 from this?</p>
  
  <pre><code>CONVERT(INT, REPLACE(CONVERT(VARCHAR(8), 2015-05-18 08:00:00.000-2015-05-18 14:00:00.000, 108), ':', '')) As maxtimepossible
  </code></pre>
  
  <p>EDIT --- </p>
  
  <pre><code>Declare @arrivaltime datetime, @departuretime datetime, timeatwork int
  SET @arrivaltime = '2015-05-18 08:00:00.000'
  SET @departuretime = '2015-05-18 14:00:00.000'
  SET @timeatwork = 0
  
  @timeatwork = CONVERT(INT, REPLACE(CONVERT(VARCHAR(8), departuretime-arrivaltime, 108), ':', '')) As maxtimepossible
  </code></pre>