Tools = {}
-- 根据秒数返回时间串
function Tools:getTimeString(time)
local hours = math.floor(time / 3600)
local minutes = math.floor((time % 3600) / 60)
local seconds = math.floor(time % 60)
if(hours < 10) then hours = "0"..hours end
if(minutes < 10) then minutes = "0"..minutes end
if(seconds < 10) then seconds = "0"..seconds end
local time = ""..hours..":"..minutes..":"..seconds
return time
end
print(Tools:getTimeString(3600)) // 输出:01:00:00
Lua根据秒数返回时间串00:00:00
最新推荐文章于 2021-06-02 11:38:16 发布