获取今日时间信息:零点时间戳,已过秒数等
local _zeroTimestamp = 0 ---今天0点的时间戳 local _wday = 0 --今天周几(1_周一, 7_周日) ---@return "今天0点时间戳, 今天已过秒数, 今天周几" function GetDayTimeInfo() local curTime = os.time() local elapseTime = curTime - _zeroTimestamp if elapseTime < 0 or elapseTime >= 24 * 3600 then local dt = os.date("*t", curTime) dt.hour = 0 dt.min = 0 dt.sec = 0 _zeroTimestamp = os.time(dt) elapseTime = curTime - _zeroTimestamp --修正星期 _wday = dt.wday if 1 == _wday then _wday = 7 else _wday = _wday - 1 end end return _zeroTimestamp, elapseTime, _wday end