Python Program to Convert Days Hours Minute Into Seconds

Python program to convert days hours minutes and seconds into seconds; Through this tutorial, i am going to show you how to convert days hours minutes and seconds into seconds in python program.

In this tutorial, i will write a python program to convert seconds to day hour minutes and seconds, which accept user input.

The Formula will convert days, hours and minutes into second in python program; as shown below with description:

days = d * 3600 * 24
hours = h * 3600
minutes = m * 60
seconds = s
time = days + hours + minutes + seconds
print("The  Total seconds :- ", time)

Here, D for days,
H for hours
M for minutes
S for seconds

Python Program to Convert Days Hours Minute Into Seconds

  • Get input days, hours, and minutes from user in python program.
  • Convert days, hour, minutes into seconds.
  • And at the last of program, print result seconds.
days = int(input("Please enter days :- ")) * 3600 * 24
hours = int(input("Please enter hours :- ")) * 3600
minutes = int(input("Please enter minutes :- ")) * 60
seconds = int(input("Please enter seconds :- "))
time = days + hours + minutes + seconds
print("The  Total seconds :- ", time)

Recommended Python Tutorials

Leave a Comment