title: How to check if current time is between a certain time period?
body: <p>I am trying to check if the current time is between a certain time period,in this case between 10:00pm to 11:00pm but running into below error,any guidance on how to fix this?</p>
  
  <pre><code>import datetime
  current_time = datetime.datetime.now().time()
  
  if '22:00' &lt;= current_time &lt;= '23:00':
      print "current time is between 10:00pm to 11:00pm"
  else:
      print "current time is NOT between 10:00pm to 11:00pm"
  </code></pre>
  
  <p>Error:-</p>
  
  <pre><code>Traceback (most recent call last):
    File "datetime_script.py", line 4, in &lt;module&gt;
      if '22:00' &lt;= current_time &lt;= '23:00':
  TypeError: can't compare datetime.time to str
  </code></pre>