Hi,
I have been struggling with this for 2 days and can't seem to find the recipe.
I simply want to compare the current time with two time boundaries, simple enough right? I don't want to deal with dates, times only.
I would like to run something like this:
t1 = '09:00:00'
t2 = '17:00:00'
timeStart = datetime.strptime(t1, '%H:%M:%S')
timeEnd = datetime.strptime(t2, '%H:%M:%S')
while datetime.now > timeStart and datetime.now < timeEnd:
#do stuff
By the way, I am running Python 3.8 with Visual Studio 2017.
Also I took the following example on this site and remove superfluous stuff but the while loop never stops:
while True:
now_time = datetime.time()
timeon_time = datetime.time(23, 00, 00, 000000)
if now_time<timeon_time: print("ok")
else: print("stop")
Thanks in advance!
I have been struggling with this for 2 days and can't seem to find the recipe.
I simply want to compare the current time with two time boundaries, simple enough right? I don't want to deal with dates, times only.
I would like to run something like this:
t1 = '09:00:00'
t2 = '17:00:00'
timeStart = datetime.strptime(t1, '%H:%M:%S')
timeEnd = datetime.strptime(t2, '%H:%M:%S')
while datetime.now > timeStart and datetime.now < timeEnd:
#do stuff
By the way, I am running Python 3.8 with Visual Studio 2017.
Also I took the following example on this site and remove superfluous stuff but the while loop never stops:
while True:
now_time = datetime.time()
timeon_time = datetime.time(23, 00, 00, 000000)
if now_time<timeon_time: print("ok")
else: print("stop")
Thanks in advance!