Example:
(these are random numbers)
14444 -->> 00d 04h 10m 20s
Example:
(these are random numbers)
14444 -->> 00d 04h 10m 20s
You can use os.date and you can convert it with one of the given formats. You can read more about it on the dev wiki page here
local currTime = os.time()
local days = math.floor(currTime/86400)
local hours = math.floor((currTime % 86400)/3600)
local minutes = math.floor(((currTime % 86400) % 3600)/60)
local seconds = math.floor((((currTime % 86400) % 3600)%60)/1)
print(string.format("%id %ih %im %is", days, hours, minutes, seconds))
Output:
Where it says “5h”, is it possibly able to make it “05h”?
(I don’t have much experience with os.time or strings in general.)
local currTime = os.time()
local days = math.floor(currTime/86400)
local hours = math.floor((currTime % 86400)/3600)
local minutes = math.floor(((currTime % 86400) % 3600)/60)
local seconds = math.floor((((currTime % 86400) % 3600)%60)/1)
print(string.format("%id %02ih %02im %02is", days, hours, minutes, seconds))
New output with change:
Yes, changed in most recent reply. It’ll show 0x for hours, minutes and seconds.
It worked, thank you!
(characters)