Answer to Question #224227 in Python for satya

Question #224227

program to count how many hours we have to get coming newyear


1
Expert's answer
2021-08-09T02:35:14-0400
from datetime import datetime
date1 = '7/8/2021'
date2 = '30/12/2021'
startDate = datetime.strptime(date1, "%d/%m/%Y")
endDate =   datetime.strptime(date2, "%d/%m/%Y")


diff = endDate.date() - startDate.date()
print('Time in hours between two dates:')
print((diff.days) * 24)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS