Dec-13-2016, 02:59 AM
The following code determines if the current time is between two times and it works well until midnight is in the range of times. Not sure how to make it allow for that case.
Pointers?
Pointers?
tm= datetime.datetime.now() now_time = tm.time() # The next line is a test for a range that crosses midnight now_time = datetime.time(23,56) strthr = 23 strtmin = 55 stphr = 0 stpmin = 5 if now_time >= datetime.time(strthr,strtmin) and now_time <= datetime.time(stphr,stpmin): print("in the range") else: print("not in the range")