博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
lua 时间转化
阅读量:4215 次
发布时间:2019-05-26

本文共 783 字,大约阅读时间需要 2 分钟。

1、

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

--把时间 秒,转化为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, timeSecondend
2、

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

local function formatTime(time)    local hour = math.floor(time/3600);    local minute = math.fmod(math.floor(time/60), 60)    local second = math.fmod(time, 60)    local rtTime = string.format("%s:%s:%s", hour, minute, second)    return rtTimeend
3、

--把1990.1.1至今的秒数,转化为年月日,时分--endTime 单位毫秒os.date("%Y-%m-%d  %H:%M",math.floor(endTime/1000))

转载地址:http://emsmi.baihongyu.com/

你可能感兴趣的文章
Linux音频编程指南
查看>>
usb-otg-调试心得
查看>>
USB规范浏览--设备和主机规范
查看>>
男人的品位--我们自己的最求
查看>>
Android (Linux) Suspend流程
查看>>
LINUX时间管理
查看>>
定时器的使用
查看>>
为Android加入busybox工具
查看>>
使用技巧busybox
查看>>
如何查看与/dev/input目录下的event对应的设备
查看>>
bootloader-bootable解析
查看>>
bootloader (LK)&&android lk bootloader中相关修改指南
查看>>
SD卡驱动分析--基于高通平台
查看>>
SD Card 驱动流程分析
查看>>
Linux之debugfs介绍
查看>>
关于sd卡中一些概念的理解
查看>>
sd卡驱动分析之相关硬件操作和总结
查看>>
linux dd命令解析
查看>>
S3C2440上touchscreen触摸屏驱动
查看>>
USB History Viewing
查看>>