title: To calculate login hours on hourly level, when you have login and logout timestamp in mysql or tableau
body: <p>I have login and logout time. Need to calculate login hours on hourly level (hour wise)</p>
  
  <p>Sample Input </p>
  
  <pre><code>Login At "2020-03-01 00:11:23" 
  Logout AT "2020-03-02 00:01:00"
  </code></pre>
  
  <p>Sample Output</p>
  
  <pre><code>Date               Hour            Login Hours
  2020-03-01          0                  0.82
  2020-03-01          1                   1
  2020-03-01          2                   1
  2020-03-01          3                   1
  2020-03-01          4                   1
  2020-03-01          5                   1
  2020-03-01          6                   1
  2020-03-01          7                   1
  2020-03-01          8                   1
  2020-03-01          9                   1
  2020-03-01          10                  1
  2020-03-01          11                  1
  2020-03-01          12                  1
  2020-03-01          13                  1
  2020-03-01          14                  1
  2020-03-01          15                  1
  2020-03-01          16                  1
  2020-03-01          17                  1
  2020-03-01          18                  1
  2020-03-01          19                  1
  2020-03-01          20                  1
  2020-03-01          21                  1
  2020-03-01          22                  1
  2020-03-01          23                  1
  2020-03-02          0                   0.02
  </code></pre>