Q
Q
qwertiss2021-06-20 20:34:09
Python
qwertiss, 2021-06-20 20:34:09

Why does datetime error occur?

I have two points

now = datetime.datetime.now()
then = datetime.datetime(2021, 6, 19, 20, 0 , 0)

I find the difference between them in minutes
delta = now - then
minutes = (delta.seconds // 60)

After which I check the last use of the daily prize
raznica = minutes - ltm
But then I get an error
print(str(minutes)+" - "+str(ltm)+" = "+str(raznica))

24 - 1 = 23

She counts not from the last date, but from today. Why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Q
qwertiss, 2021-06-20
@qwertiss

Long story short, I fixed it.
Delta.total_seconds() should be used instead of delta.seconds

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question