title: PHP: How to compare a time string with date('H:i')?
body: <p>I have time saved in database like 7:30pm as a varchar field. I want to check if this time is greater than time right now or not.</p>
  
  <p>I converted the DB time string into '19:30' and now I want to do something like this:</p>
  
  <pre><code>$my_time = '19:30';
  
  if($my_time  &gt; date('H:i'))
  {
      do something ...
  }
  </code></pre>
  
  <p>The problem is the above will return always true if $my_time is non-empty string.</p>
  
  <p>doing <code>strtotime($my_time)</code> is not helping either.</p>
  
  <p><code>strtotime('H:i',$my_time)</code> makes it 00:00 .</p>
  
  <p>doing <code>(int)date('H:i')</code> will give 1700 when the actual time is 17:09, so removing colon and then comparing will not work too ....</p>
  
  <p>Changing database time data is out of question in this context.</p>
  
  <p>plz help. Correct me if I stated some facts wrong.</p>