How can I get the current hour from a linux timestamp? I can get the year, month, day, minute, and second, but not the hour. Any help?
Current code:
local secondsPassed = os ~= nil and os.time() or tick()
local year = 1970 + math.floor(secondsPassed / (86400 * 365.25))
local days = math.floor((secondsPassed % (365.25 * 86400)) / 86400)
days = days + (year - 2011)
local minutes = math.floor((secondsPassed % 3600) / 60)
local seconds = math.floor(secondsPassed % 60)
Broken:
local hours = math.floor((secondsPassed % 86400) / 3600)-- +1