Convert seconds into days, hours, minutes and seconds

后端 未结 24 2636
说谎
说谎 2020-11-22 16:30

I would like to convert a variable $uptime which is seconds, into days, hours, minutes and seconds.

Example:



        
24条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 17:12

    gmdate("d H:i:s",1640467);
    

    Result will be 19 23:41:07. When it is just one second more than normal day, it is increasing the day value for 1 day. This is why it show 19. You can explode the result for your needs and fix this.

提交回复
热议问题