I have looked around to see if I can find a simple method in Python to find out if a date has passed.
For example:-
If the date is 01/05/2015
, and the date; 30/04/2015
was in-putted into Python, it would return True, to say the date has passed.
This needs to be as simple and efficient as possible.
Thanks for any help.
you may use datetime, first parse String to date, then you can compare
import datetime
d1 = datetime.datetime.strptime('05/01/2015', "%d/%m/%Y").date()
d2 = datetime.datetime.strptime('30/04/2015', "%d/%m/%Y").date()
d2>d1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With