How to check if a date has passed in Python (simple)
I have looked to see if I can find a simple method in Python to see if a date has passed.
For example: - If the date 01/05/2015
and date; 30/04/2015
was placed in Python, it will return True to say the date has passed.
It should be as simple and efficient as possible.
Thanks for any help.
+3
source to share
3 answers
from datetime import datetime
present = datetime.now()
print datetime(2015,04,30) < present #should return true
Got stuff from this question / answer: How do I compare two dates?
+3
source to share