Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get the time, in UTC, using scripting? [SOLVED]

Asked by
Minifig77 190
10 years ago

To make coordination easier, I am deciding to use UTC (Universal Coordinated Time) among my group. What I want do do is make a clock inside of the game that reads UCT. Is there any way I can get that time inside of a game?

2
Using (internal) ROBLOX apis, I believe this is not strictly possible. `tick()` and various time functions return time relative to a particular time zone (although this timezone is known and apparently constant). Using HttpService overcomes this problem. BlueTaslem 18071 — 10y
2
Tick returns the UNIX time of any particular timezone that the roblox server is running in. Therefore, using os.time(), which returns the true unix time, you could calculate the time for any timezone using the correct time differences. Articulating 1335 — 10y

1 answer

Log in to vote
0
Answered by
Minifig77 190
10 years ago

I tried what Articulating said in the comments -- using os.time() I actually managed to create a working script that finds the UCT with os.time()

For future reference, here are the algorithms for calculating the time with os.time(), assuming that Time = os.time()

math.floor((Time%86400)/3600) Calculates the hours after midnight, UCT, 24 hour format. math.floor((Time%3600)/60) Calculates the minutes after the hour. Time%60 Calculates the seconds after the minute.

Ad

Answer this question