I have this check
if is_time_between(time(6,59,45), time(18,10)):
I want to check if the current time is between the two times I pass in. I think im close.
#from datetime import timezone, datetime, timedelta
from datetime import datetime, time
#import time
import pytz
import dateutil.parser
#from pytz import timezone
def is_time_between(begin_time, end_time):
tz = pytz.timezone('Australia/Sydney')
check_time = datetime.time(tz)
if begin_time < end_time:
return check_time >= begin_time and check_time <= end_time
else: # crosses midnight
return check_time >= begin_time or check_time <= end_time
I've gotten multiple errors playing around with imports and froms but the current one is:
descriptor 'time' requires a 'datetime.datetime' object but received a 'Australia/Sydney'