SecondsToDays

Two functions for formatting seconds (as returned by TIME_PLAYED_MSG or by GetQuestResetTime()) to a human-readable format.

formatSeconds

This is a user-defined function that you can copy and paste into your addon.

Converts seconds to "s", "m:ss", "h:mm:ss", or "d:hh:mm:ss" format

local function formatSeconds(seconds)
local d, h, m, s;
-- Allowing fractional values, since string:format("%d") will coerce to integer
d =  seconds / 86400;                -- 86400 seconds in a day
h = (seconds % 86400) / 3600;        -- seconds in the left-over day, divided by seconds in an hour
m = (seconds % 86400  % 3600) / 60;  -- seconds in the left-over hour, divided by seconds in a minute
s =  seconds % 86400  % 3600  % 60;  -- seconds in the left-over minute
-- Add or remove output formats you want
if d >= 1 then return ("%d:%02d:%02d:%02d"):format(d,h,m,s); end;
if h >= 1 then return (     "%d:%02d:%02d"):format(  h,m,s); end;
-- For better clarity, you could keep the minutes even if they're zero:
--             return (          "%d:%02d"):format(    m,s);
if m >= 1 then return (          "%d:%02d"):format(    m,s); end;
return s;
end

Examples

Example usage:

/run print("Dailies rollover in "..formatSeconds(GetQuestResetTime()))

Example runs:

/run print(formatSeconds(100))
1:40
/run print(formatSeconds(100000))
1:03:46:40
/run print(formatSeconds(3606))
1:00:06

Fractions are ignored:

/run print(formatSeconds(3606.4))
1:00:06

Negative numbers wind up being interpreted oddly, but understandably:

/run print(formatSeconds(-3))
23:59:57
/run print(formatSeconds(-3606))
22:59:54