**Programming** Examples

# Python program to input the time in second and convert into hours minute and seconds

Write a python code to input the time in seconds. Display the time after converting it into hours, minutes and seconds.

**Sample Output:** Time in Second 5420

**Sample Output:** 1 Hour 30 Minutes 20 Seconds

Solution 1:

```
sec=int(input("Enter time in Second : "))
hour=sec//3600
rem=sec%3600
min=rem//60
sec=rem%60
print(hour," hour ",min," minute and ",sec," second")
```

**Solution 2:**

```
sec=int(input("Enter time in Second : "))
hour=sec//3600
min=(sec%3600)//60
sec=(sec%3600)%60
print(hour," hour ",min," minute and ",sec," second")
```

`Output`