Format Seconds Into Time Intervals

A function that takes a number of seconds, and returns values for weeks, days, hours, minutes, and seconds.

local weeks, days, hours, minutes, seconds = FormatSeconds(secondsValue)
function FormatSeconds(secondsArg)
local weeks = math.floor(secondsArg / 604800)
local remainder = secondsArg % 604800
local days = math.floor(remainder / 86400)
local remainder = remainder % 86400
local hours = math.floor(remainder / 3600)
local remainder = remainder % 3600
local minutes = math.floor(remainder / 60)
local seconds = remainder % 60
return weeks, days, hours, minutes, seconds
end