Using Lua to format 0 seconds as 00:00:00

后端 未结 2 1687
花落未央
花落未央 2021-01-05 03:46

I\'m trying to format a duration (in seconds) as a time and I\'m getting results indicating that I\'m supposed to account for an epoch somewhere. I expected os.date(\"

2条回答
  •  梦毁少年i
    2021-01-05 04:32

    Lua does not have a vast standard library:

    string.format("%.2d:%.2d:%.2d", s/(60*60), s/60%60, s%60)
    

提交回复
热议问题