Hello! I’m looking to make a live event system that uses the EST timezone instead of the UTC.
I’ve tried to subtract 5 hours in seconds to the UNIX timestamp. But it just says 31 days instead of 2 hours remaining.
Server script:
local panel = workspace:WaitForChild("Panel")
local gui = panel.Gui
local module = require(game.ReplicatedStorage.LiveEvent)
-- this should be on EST
local eventTime = os.time({
year = 2021,
month = 12,
day = 11,
hour = 20,
min = 10,
sec = 0
})
gui.time.Text = os.date("!%x", eventTime) .. " " .. os.date("!%X", eventTime)
while task.wait(1) do
local est = module:GetEST()
local diff = eventTime - est
gui.left.Text = module:TimeLeft(diff)
end
Module script:
local ls = {}
function ls:TimeLeft(sec)
local dt = os.date("!*t", sec)
local d = tostring(dt["day"])
local h = tostring(dt["hour"])
local m = tostring(dt["min"])
local s = tostring(dt["sec"])
return d .. " Days and " .. h .. " hours and " .. m .. " minutes and " .. s .. " seconds left."
end
function ls:GetEST()
local currentTime = os.time() - 18000
return currentTime
end
function ls:FormatEST()
local est = ls:GetEST()
local formatted = os.date("!%X", est)
return formatted
end
return ls
How it looks in game:

