To convert day, hour, and minute into second in python. In this tutorial, you will learn how to convert day, hour, a minute into second in python.
So, this tutorial will show you each thing about how to convert day, hour, and minute into second in python.
First of all, you need to know the formula for converting day, hour, and minute into second in python. And this tutorial will show you each thing about How to convert day, hour, and minute into second in python.
Note that, this tutorial will not use the python DateTime module. In this tutorial, you will learn simple and easy way to convert hours, minutes, seconds.
As well as, this program will accept time inputted in days, hours, and hours and convert it into seconds in python.
Note that, the following formula will convert days, hours, and minutes into seconds:
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
Which you want to convert into seconds.
Now, this tutorial will show you how to convert days, hours, and minute into seconds in python.
Python programs to convert days hour minutes into seconds
Use the following steps and write a python program to convert days hour minutes into seconds:
- Take input days, hours, and minutes from user.
- Convert seconds to a days, hour, minutes, and seconds.
- And at the last of program, print result.
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)