Is It Possible To Check Day And Timestamp Between Two Different Days With Time Stamps?
curr_time = 'Thursday 1:03:00' time_range = ['Wednesday 6:12:00', 'Thursday 6:12:00'] def is_between(self,curr_time, time_range): if time_range[1] < time_range[0]: r
Solution 1:
The problem is that you are comparing two strings. The days of the week are input as strings so the code compares the characters of the strings instead of the days of the week. I'd suggest using datetime objects from the datetime module for python:
Python3: https://docs.python.org/3/library/datetime.html#module-datetime
Python2: https://docs.python.org/2/library/datetime.html#module-datetime
If you have the user input the days and times within datetime objects they should be more easily comparable within your current code.
Post a Comment for "Is It Possible To Check Day And Timestamp Between Two Different Days With Time Stamps?"