Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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 comments

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.

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.

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.