Python current time comparison with other time
<p>I am looking for a comparison of two times in Python. One time is the real time from computer and the other time is stored in a string formatted like <code>"01:23:00"</code>.</p>

<pre><code>import time

ctime = time.strptime("%H:%M:%S")   # this always takes system time
time2 = "08:00:00"

if (ctime &gt; time2):
    print "foo"
</code></pre>

<pre><code>from datetime import datetime
current_time = datetime.strftime(datetime.utcnow(),"%H:%M:%S") #output: 11:12:12
mytime = "10:12:34"
if current_time &gt;  mytime:
    print "Time has passed."
</code></pre>

python python-2.7 datetime