title: Comparing two DateTimeOffsets?
body: <p>I have two DateTimeOffset objects, which return like so when logging them:</p>
  
  <pre><code>TIME 1 (db):     3/17/2016 2:25:37 PM +00:00
  TIME 2 (client): 3/17/2016 2:09:19 PM -04:00
  TIME 2 &lt; TIME 1? False
  </code></pre>
  
  <p>I don't want to clutter this with code, but comparison is made like this (as per <a href="https://msdn.microsoft.com/en-us/library/system.datetimeoffset.op_greaterthan(v=vs.110).aspx" rel="nofollow noreferrer">MSDN</a>):</p>
  
  <pre><code>bool didUserLoginBeforeSysUpdate = clientLoginTime &lt; lastSystemUpdateTimeFromDb;
  </code></pre>
  
  <p>I think my main misunderstanding comes from whether or not it's factoring in the time zone adjustment (<code>+00:00/-04:00</code>) in the comparison. My understanding is that it does NOT and compares the raw times as per this <a href="https://stackoverflow.com/questions/25673103/how-to-compare-two-datetimeoffset">SO post</a>.</p>
  
  <blockquote>
    <p>However, the timezone part is ignored when comparisons are made. In
    other words, each date time is converted to GMT / UTC and those are
    compared.</p>
  </blockquote>
  
  <p>So, in short, what am I doing wrong? Why isn't TIME 2 showing as being earlier than TIME 1? </p>
  
  <p>EDIT:</p>
  
  <pre><code>    bool didUserLoginBeforeSysUpdate = clientLoginTime.ToUniversalTime() &lt; lastSystemUpdateTimeFromDb.ToUniversalTime();
  
      var didUserLoginBeforeSysUpdateComparison = clientLoginTime.CompareTo(lastSystemUpdateTimeFromDb);
  
  brkptTIME 1 (db):     3/17/2016 2:25:37 PM +00:00
  TIME 2 (client): 3/17/2016 2:09:19 PM -04:00
  TIME 1 AFTER UTC CONVERSION(db):     3/17/2016 2:25:37 PM +00:00
  TIME 2 AFTER UTC CONVERSION(client): 3/17/2016 6:09:19 PM +00:00
  TIME 2(UTC)  &lt; TIME 1(UTC) ? False
  COMPARISON RESULT - is TIME 2 earlier than TIME 1?: 1 Key: Earlier = -1, Same = 0, Later = 1
  </code></pre>
  
  <p>Looks like I am misunderstanding how UTC saves. I thought <code>3/17/2016 2:09:19 PM -04:00</code> meant that "Universal time is 2:09:19 pm, and the local time where it was stored is 4 hours earlier. Anyway, I need to ask a different question, thanks for the help guys. </p>