Roblox OS Time [ ASK ]

So from how I know for OS time (for time, not dates), it shows hours, minutes and seconds? how to make it hours, minutes, seconds, mili-seconds of our os.time() ? Let’s say my time now is 10:52:30, I want it to not only print 10:52:30, but print miliseconds of time too? Is there a way? but printing real time.

Ex : Like in Command Prompt or Windows Terminal when we use Time it prints Hours:Minutes:Seconds.Miliseconds

1 Like

I believe DateTime does this?
Edit: DateTime.now():ToUniversalTime() may be of specific interest to you.

1 Like

for miliseconds use fractional second?

This should work

local universalTime = DateTime.now():ToUniversalTime()
local str = string.format("%d:%d:%d.%d", universalTime.Hour, universalTime.Minute, universalTime.Second, universalTime.Millisecond)
print(str)
2 Likes