I need to compare two dates given below:
my_date = 'Mar 15 00:00:00 2019'
date_to_check = "Sep 17 04:00:05 2018"
if my_date<=date_to_check:
print(True)
It should not print anything. But it is printing 'True'. I figured out the problem- It is comparing only Mar 15 to Sep 17, not taking year into consideration. And I cannot change date format to some other because I need to compare the dates in the text file.
Any comments on this.