title: How to compare two instants in Java?
body: <p><strong>I want comparison two <code>Instant</code>s to see if equals both or greater than</strong>, but i can’t.
  i dont know. how i can compare instants?</p>
  <pre><code>  private Instant expiration;
  
   if(expiration()==Instant.now()||expiration()&gt;Instant.now())
    {
       valid+=&quot;the Expire date is invalid check it . &quot;;
    }
  </code></pre>
  <p>i  try this way but i have compile error.
  but i think cant comparison in this way
  it  must change instant to String and compare after it
  but i dont know how to format to string</p>