So, I’m doing an Easter Egg for my game BloodLine - Alpha , that when your computer clock is 11:11 AM, a creature looks at you until it’s 11:16. Is it possible on ROBLOX?
Hopefuly this link helps:
You have to do this based on time values. The easiest way is probably for the client to send its os.time() value to the server and for the server to compare that with its own os.time() value, dividing that by 3600, and rounding it to the nearest timezone hour offset from UTC+0. Keep in mind this will always be an estimate because you cannot know whether the time settings of the client’s device are entirely correct.
Do you have a particular use case for wanting to estimate the time zone?
1 Like
Since you are looking for the player’s local time, this might help
os.date lets you grab information based on both the users local timezone and UTC.
You could do os.date("*t") for local time, os.date("!*t") for UTC, and then get the difference between them. (Passing the tables they return as the argument to os.time returns a raw number of seconds, which allows for easier subtraction.)
From there, you know how far their local time is offset from UTC, so you can apply that same offset to your date.
1 Like
SOTR654
(SOTR654)
April 19, 2021, 11:59pm
#4
Use os.time and os.date :
local result = os.date("%X",os.time())
1 Like
Thank you guys for the fast answers, I’ll try that out.
Tsu Washington / SovietFurryBruh.
1 Like