美文网首页
两个时间戳相减 获得的秒 装换为 年 月 天 时 分

两个时间戳相减 获得的秒 装换为 年 月 天 时 分

作者: 陈玉涛 | 来源:发表于2018-09-03 16:34 被阅读0次
        --下面两个时间自己设置
        local left_time = GetLeftTime() --离开时间
        local cur_server_time = GetCurTime() --当前时间
        timestamp_year = math.floor((cur_server_time - left_time)/ (3600 * 24 * 30 * 12)) --年
        timestamp_month = math.floor((cur_server_time - left_time)/ (3600 * 24 * 30)) --月
        timestamp_day = math.floor((cur_server_time - left_time)/ (3600 * 24)) --日
        timestamp_hour = math.floor((cur_server_time - left_time)/ 3600) --小时
        timestamp_minutes = math.floor((cur_server_time - left_time)/ 60) --分钟

相关文章

网友评论

      本文标题:两个时间戳相减 获得的秒 装换为 年 月 天 时 分

      本文链接:https://www.haomeiwen.com/subject/iwhiwftx.html