Get Time (eg 16:45) | Scripting Help

So… I want to get the 24 hours time, like 16:45 or 08:13

In my script I can get the epox time with

local epox = os.time()

So I have the epox varible, but how do i get for examples 14:45

Maybe this can help:

You can use and os.time() together to have it in your desired format.

You can pretty easily do this like this, use and pass your formatString and then the timestamp:

local ts = os.time();
print('%H:%M', ts)) --Prints 20:04, for me, as that is the time for me currently.

you can use for that, specifically:"*t")  -- to return local time"!*t") -- to return UTC time

I ended up using this script.

local stringToFormat = "%H:%M"

local timestamp = os.time()

local result =, timestamp)


but @WaterJamesPlough script looks usable for me as well as it is split in half to my current one.

local ts = os.time();
print('%H:%M', ts))

Ok sure!
Mark it as the solution then.

Good luck on your projects, have a nice day!

I believe you understand that basically does the same thing, except you have differently formatted script with different variables.

Yeah, also, how would I make this an infinite loop which fires every minute?

while true do
    -- do something
1 Like

Thanks everryone.

I will soulotion this now.

you could do a while true do loop, that waits 60 Seconds after executing.

while true do
   --Bla Bla
1 Like