素材巴巴 > 程序开发 >

获取指定日期的时间戳

程序开发 2023-09-15 09:44:04
--获取指定日期的时间戳
 function getSpecifiedDate(timestamp, intervalDay)local timeInfo = os.date("*t", timestamp)--间隔天数if intervalDay thentimeInfo.day = timeInfo.day + intervalDaytimeInfo.hour = 23timeInfo.min = 59timeInfo.sec = 59endlocal 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 
 endlocal 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), "调整日期")
 

在这里插入图片描述


标签:

上一篇: MVC、MVVM和单向数据流的对比 下一篇:
素材巴巴 Copyright © 2013-2021 http://www.sucaibaba.com/. Some Rights Reserved. 备案号:备案中。