Hello! I am trying to get the start & end timestamp of the Current Week using os.date(“!*t”) (utc)
So far I’ve came up with this:
local today = os.date("!*t")
local start = os.time({
year = today.year,
month = today.month,
day = today.day - today.wday + 1,
hour = 0,
min = 0,
sec = 0
})
local endDay = start + (5 * 24 * 60 * 60)
local endT = os.date("!*t", endDay)
endT.hour = 23
endT.min = 59
endT.sec = 0
print("Today: " .. os.date("%c", os.time(today)))
print("Start: " .. os.date("%c", start))
print("End: " .. os.date("%c", os.time(endT)))
But it doesn’t really work because once the day changes, the dates will be delayed.
Thank you if you help me find a solution!