I’m trying to make a new years countdown script but realized that the counter works BUT it doesn’t match the timezone that I’m currently in… How do I fix this?
local newYear = os.time({year = os.date("%Y", os.time() + (365*24*60*60) - (24*60*60)), month = 1, day = 1})
while wait(1) do
local currentTime = os.time()
local timeDiff = newYear - currentTime
local d = math.floor(timeDiff/60/60/24)
local h = string.format("%0.2i", math.floor((timeDiff - (d*60*60*24))/60/60))
local m = string.format("%0.2i", math.floor((timeDiff - (d*60*60*24) - (h*60*60))/60))
local s = string.format("%0.2i", timeDiff - (d*60*60*24) - (h*60*60) - (m*60))
local formattedTime = d .. ":" .. h .. ":" .. m .. ":" .. s
script.Parent.Clock.ClockGui.TimeToNewYear.Text = timeDiff <= 0 and "00:00:00:00" or formattedTime
if timeDiff <= 0 then
break
end
end
local hours = 5
--os.time() returns the number of seconds since the unix timestamp
local seconds = os.time()-hours*3600 --an hour has 3600 seconds
local date = os.date("!*t", seconds)
print(date.year, date.month, date.day, date.hour, date.min, date.sec)