How do I print os.time using the format Hours:Minutes ?
✓ ANSWER ACCEPTED
How do I print os.time?
1 answer
✓ Accepted answer
Normal Lua has a function os.date to format times. Unfortunately, ROBLOX lacks this function.
You can use a ModuleScript that someone else has written to do this for you (there are a few, I've made on here).
While date-time is fairly problematic, just hours and minutes isn't so bad.
In Unix time, every day has precisely 86400 seconds in it; a minute has precisely 60 seconds and an hour has precisely 60 minutes.
Then
local now = os.clock() -- in seconds
local second = now % 60
now = (now - second)/60 -- in minutes
local minute = now % 60
now = (now - minute)/60 -- in hours
if minute < 10 then
print(hour .. ":0" .. minute)
else
print(hour .. ":" .. minute)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
So just run this in a Local Script or a regular script?
Either, it doesn't matter. You can only completely trust that os.time() is UTC time on a server, though (though on a normal client it will be UTC)