Fomatting seconds

Right now, my goal is to achieve a contract system.

  • This “contract system” is time-based, if the time expires it will reset and randomize.

But here comes our first issue!

local ttime = result - os.time() 
local res = os.date("%H hours %M minutes", ttime)
print(res)
print(ttime)

This is the code I use for formatting time to contract reset.
It is working!
But pretty innaccurate!

In output I get:

  • Formatted time 00 hours 57 minutes
  • Seconds I formatted 53867

You may not get it, but in fact:
image

Any alternatives to os.date?
Any ways to fix the issue?
Have I missunderstood os.date?

2 Likes

according to google divide the seconds by 60

print(os.time / 60)
1 Like

that is to get only the minutes

multiply the minutes by 60

print(os.time * 60)

listen dude I know how to do it dont teach me

os.time already returns seconds so no need to do * 60

image

no need to be rude, he is trying to help you :sad:

I know. And I am not trying to be rude. Just telling him to not teach me how to convert seconds into minutes. cuz its easy tbh.

thank you for helping!

was searching of alternatives, checked thread, opened and it really helped me

well welcome glad yo help you!