Lua时间转化的几个小例子(lua时间函数)不看后悔

随心笔谈1年前 (2023)发布 admin
149 0

–把时间 秒,转化为xx天xx时xx分xx秒 的形式

function convertTimeForm(second)

    local timeDay                  =math.floor(second/86400)

    local timeHour                 =math.fmod(math.floor(second/3600), 24)

    local timeMinute               =math.fmod(math.floor(second/60), 60)

    local timeSecond               =math.fmod(second, 60)

    return timeDay, timeHour, timeMinute, timeSecond

end

© 版权声明

相关文章