--获取指定日期的时间戳
function getSpecifiedDate(timestamp, intervalDay)
local timeInfo = os.date("*t", timestamp)
--间隔天数
if intervalDay then
timeInfo.day = timeInfo.day + intervalDay
timeInfo.hour = 23
timeInfo.min = 59
timeInfo.sec = 59
end
local need_timestamp = os.time{year = timeInfo.year, month = timeInfo.month, day = timeInfo.day, hour = timeInfo.hour, min = timeInfo.min, sec = timeInfo.sec}
return need_timestamp
end
local time = getSpecifiedDate(os.time(), 1)
print(os.date("%Y年%m月%d日 %H:%M:%S", os.time()), "设置日期")
print(os.date("%Y年%m月%d日 %H:%M:%S", time), "调整日期")
获取指定日期的时间戳
最新推荐文章于 2024-05-07 07:56:45 发布