Help with calculating a remaining time

Basically its just maths and I can’t do maths

So this I what I have so far:

local readyTime = Profile.Data.LastLogin
local currentTime = os.time()

local remaining = currentTime-readyTime
print(remaining)

print("❌ No reward ready for "..player.Name.." | Come back in ", os.date("%X", remaining))

And i just simply cannot work out how to get the remaining time
Because clearly currentTime-readyTime is wrong because it returns something like 19:28:21 and my readyTime variable is equal to 1637099166

You could transform the seconds to hours and minutes

function convertToHMS(Seconds)
	local Minutes = (Seconds - Seconds%60)/60
	Seconds = Seconds - Minutes*60
	local Hours = (Minutes - Minutes%60)/60
	Minutes = Minutes - Hours*60
	return ("%02i"):format(Hours)..":"..("%02i"):format(Minutes)..":"..("%02i"):format(Seconds)
end

local Now = os.time()
local W = 1637099166

warn(Now)
print(os.date("%c", Now))

warn(W)
print(os.date("%c", W))

local C = Now - W
warn(C)
print(convertToHMS(C))

image

Original post: