Answers for "python time to hours minutes seconds"

1

python datetime to seconds

from datetime import datetime
dt = datetime.today()  # Get timezone naive now
seconds = dt.timestamp()
Posted by: Guest on April-07-2021
1

convert seconds to hours python

method = a
import datetime
str(datetime.timedelta(seconds=666))
'0:11:06'

method = b
def convert(seconds):
    seconds = seconds % (24 * 3600)
    hour = seconds // 3600
    seconds %= 3600
    minutes = seconds // 60
    seconds %= 60      
    return "%d:%02d:%02d" % (hour, minutes, seconds)
Posted by: Guest on May-09-2021

Code answers related to "python time to hours minutes seconds"

Python Answers by Framework

Browse Popular Code Answers by Language