Lua 时间的一些计算

1. 获取到第二天0点倒计时

备注: 返回秒,根据需求可以自行换算

-- 获取到第二日0点的剩余时间 返回秒数
local function GetRemainSecondsTo24()
	local time = os.date("*t")
	local targetTime = os.time({ year = time.year, month = time.month, day = time.day, hour = 23, min = 59, sec = 59 })
	return targetTime - os.time() + 1
end

猜你喜欢

转载自blog.csdn.net/qq_33808037/article/details/125207069