title: Compare datetime to current datetime in mysql?
body: <p>i'm currently working on compare both date and time to the current date and time in mysql but something not logic occurs, take a look on mysql statement<br/><br/></p>
  
  <pre><code>SELECT * FROM table WHERE expiry_date_time &gt; NOW()
  </code></pre>
  
  <p>i expect that as long as the expiry date and time is larger than NOW() so it's still active and not expire.<br/>
  When i tested it with already non expired row it failed and when changing from ">" to "&lt;" it works !!!
  <br/><br/>What's wrong with my code or logic ?!
  <br/><br/>
  <strong>EDIT:-</strong><br/><br/>
  expiry_date_time is column of type DATETIME
  <br/><br/>
  sample date :-<br/>
  <img src="https://i.stack.imgur.com/qdLxl.jpg" alt="enter image description here"></p>
  
  <pre>
  +----+---------------------+---------------------+-----------+
  | id | expiry_date_time    | add_date_time       | is_active |
  +----+---------------------+---------------------+-----------+
  | 38 | 2014-10-09 02:17:29 | 2014-10-09 01:00:29 | ☺         |
  +----+---------------------+---------------------+-----------+
  </pre>
  
  <p><br/>
  <strong>Edit 2:-</strong>
  <br/><br/>
  I discovered an error in my php code prevent outputting NOW() correctly, so the logic and query above work perfectly with no error</p>