Reputation: 1
I'm trying to figure out how to return the difference of time in between now and from the last minute of this year. I seem to be getting errors saying "Parameter 'day' unfilled" and "Parameter 'month' unfilled".
from datetime import datetime
rn = datetime.now()
ny = datetime('2022, 12, 31, 23, 59')
df = ny - rn
print(df.total_seconds())
if anyone could help out with this that would be greatly appreciated!
Upvotes: 0
Views: 250
Reputation: 1884
You used a single string as parameter, you'd have to either use strptime
to parse the string, or otherwise get your actual numbers out of the string
datetime(2022, 12, 31, 23, 59)
datetime.strptime('2022, 12, 31, 23, 59', "%Y, %m, %d, %H, %M")
Upvotes: 1