0

Hi. Does anyone know how to go from seconds to days, hours, minutes and seconds?

Pyton g

23rd Mar 2020, 11:21 PM
Yony Aybar
Yony Aybar - avatar
6 Answers
+ 2
Unclear What purpose are you achieving? What function are you using? Please show your code here so that we can help you https://www.sololearn.com/post/75089/?ref=app In general, multiply by 60 for seconds to be minutes, multiple by 60 for minutes to be hours, etc.
23rd Mar 2020, 11:42 PM
Gordon
Gordon - avatar
+ 2
So what you're asking is: Given a duration in seconds You want to convert it to days hours minutes seconds?
23rd Mar 2020, 11:44 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
0
a=int(raw_inpit("")) print dias= second / (24*60*60) second= (second % (24*60*60)) hour= (second/(60*60)) hour= (second % (60*60)) minutes=(hour/60) minutes=(second /60) second =(minutes / 60) print " % d seconds equals:% d days,% d hours,% d minutes,% d   seconds " % (second, day, minute, second
24th Mar 2020, 12:08 AM
Yony Aybar
Yony Aybar - avatar
0
I did it like that
24th Mar 2020, 12:08 AM
Yony Aybar
Yony Aybar - avatar
0
Prometheus Yes, that exactly
24th Mar 2020, 12:12 AM
Yony Aybar
Yony Aybar - avatar
0
here you go sec = float(input()) mtn = sec/60 hr = mtn/60 day = hr/24
24th Mar 2020, 12:22 AM
Choe
Choe - avatar