Answer the question
In order to leave comments, you need to log in
How to compare a day of the month (now) with a specific day and month using python?
Hello. Python3 datetime.
Such a task: when you click on the button, you need to compare datetime.now() and if the day and month are greater than March 10 - fun1() , otherwise func2() .
Something terribly stupid. Can't compare day and month
Answer the question
In order to leave comments, you need to log in
dtNow = datetime.datetime.now()
dtDeadline = datetime.datetime(dtNow.year, 3, 10) # 10 марта
if dtNow > dtDeadline:
print("Дедлайн прошел")
dtNow = datetime.now()
dtTemp = datetime.date(year, month, day)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question