How do I convert seconds to hours, minutes and seconds?

前端 未结 12 2280
执笔经年
执笔经年 2020-11-22 11:00

I have a function that returns information in seconds, but I need to store that information in hours:minutes:seconds.

Is there an easy way to convert the seconds to

12条回答
  •  春和景丽
    2020-11-22 11:42

    You can divide seconds by 60 to get the minutes

    import time
    seconds = time.time()
    minutes = seconds / 60
    print(minutes)
    

    When you divide it by 60 again, you will get the hours

提交回复
热议问题