PHP — Convert milliseconds to Hours : Minutes : Seconds.fractional

后端 未结 4 728
长情又很酷
长情又很酷 2020-12-30 04:56

I\'ve got a script that takes in a value in seconds (to 2 decimal points of fractional seconds):

$seconds_input = 23.75

I then convert it t

4条回答
  •  离开以前
    2020-12-30 05:19

    Mine is much less readable, so it must be better. :p

    Basically the same idea as @ircmaxell's version. It does trim the trailing '0's and even will skip the last '.' separator if milliseconds are 0.

提交回复
热议问题