|
发表于 2023-8-25 22:02:41
|
显示全部楼层
function secondsToTime(ts)
local seconds = math.mod(ts, 60)
local min = math.floor(ts/60)
local hour = math.floor(min/60)
local day = math.floor(hour/24)
local str = ""
if tonumber(seconds) > 0 and tonumber(seconds) < 60 then
str = ""..seconds.."秒" ..str
end
if tonumber(min - hour*60)>0 and tonumber(min - hour*60)<60 then
str = ""..(min - hour*60).."分"..str
end
if tonumber(hour - day*24)>0 and tonumber(hour - day*60)<24 then
str = (hour - day*24).."时"..str
end
if tonumber(day) > 0 then
str = day.."天"..str
end
return str
end
|
|