I am writing a simple program that displays a countdown in a console.
I want it to reset it for the same date of the next year once the countdown has reached 0.
For example, if the deadline is set to Christmas 2006, I want it simply to add years while the countdown isn't greater than 0 microseconds.
2006+1+1=2008
However, if I try this :
while countdown <= datetime.timedelta(0) :
deadline = deadline + datetime.datetime.year(1)
There's an error:
"TypeError: 'years' is an invalid keyword argument for this function"
I could simply add datetime.timedelta(days=365), but, now, there's a problem with leap years...
Please help me.
Thank you!
Tags: