I’m trying to make the game time sync to the Gulf Standard Time [or Dubai time], but I have not found any methods, I tried os.time() and os.date(), but it only works for UTC Time, I also tried DateTime but there isn’t a way to sync the timezone. I know I could get an Http Request but the issues are that it doesn’t work for the client, and rate limits, I am trying to get the time every second, Nothing appears in the output
local Lighting = game:GetService("Lighting")
local RunService = game:GetService("RunService")
RunService.PreRender:Connect(function()
Lighting.TimeOfDay = os.date("%X")
end)
You can use DateTime and use a bit of math to get the GST Time Zone
local Lighting = game:GetService("Lighting")
local RunService = game:GetService("RunService")
RunService.Heartbeat:Connect(function()
local D = DateTime.now()
local TimeTable = D:ToUniversalTime()
local HourConvert = TimeTable.Hour + 3
Lighting.TimeOfDay = HourConvert ..":"..TimeTable.Minute..":"..TimeTable.Second
end)
If you do DateTime.fromUnixTimestamp(os.time()) this is set to UTC time, you can then offset this value by however much you need too - for example -5 hours is os.time() - 18000.