计算今天零点时间戳方式2

 

function GetDayTimeInfo2()
    local nowUtcSec = os.time()
    --先计算出时区
    local dateTime = os.date("!*t", nowUtcSec) --内部不加时区
    local timeZoneSec = os.difftime(nowUtcSec, os.time(dateTime))

    local elapseTime = math.fmod(nowUtcSec + timeZoneSec, 24 * 3600)
    local zeroTimestamp = nowUtcSec - elapseTime
    return zeroTimestamp, elapseTime
end

 

posted @ 2024-08-23 23:22  yanghui01  阅读(10)  评论(0编辑  收藏  举报