Formatting milliseconds as days, hours, minutes, and seconds
The Decimal Point

Exponential notation is by far the better for large numbers.

However when writing numbers in this format the convention is to have the decimal point after the first digit, as the exponent represents the magnitude of the value which is obscured if you have to locate the decimal point.

d = Math.floor(t / 8.64e7), 
h = Math.floor(t % 8.64e7 / 3.6e6), 
m = Math.floor(t % 3.6e6 / 6e4), 
s = Math.floor(t % 6e4 / 1e3);


As constants

But.. These are magic numbers, and you repeat some of them several times, which is prone to error. Also assuming that this function would be part of a set of such functions declaring these constants as named variables would be much better.

DAY_MS = 8.64e7;
HOUR_MS = 3.6e6;
MIN_MS = 6e4;
SEC_MS = 1e3;


Derived values

As they are derived from each other you can then write it as

SEC_MS = 1e3;
MIN_MS = SEC_MS * 60;
HOUR_MS = MIN_MS * 60;
DAY_MS = HOUR_MS * 24;


Encapsulate

If you then encapsulate them you can drop the _MS and your function would look like.

"use strict";
const dhms = (()=&gt;{
    const SEC = 1e3;
    const MIN = SEC * 60;
    const HOUR = MIN * 60;
    const DAY = HOUR * 24;
    return time =&gt; {
        const ms = Math.abs(time);
        const d = ms / DAY | 0;
        const h = ms % DAY / HOUR | 0;
        const m = ms % HOUR / MIN | 0;
        const s = ms % MIN / SEC | 0;
        return `${time &lt; 0 ? "-" : ""}${d}Day(s) ${h}Hour(s) ${m}Minute(s) ${s}Second(s)`;
    };
})();


Notes


That t is made positive ms to avoid a negative sign on each number. This also lets you use the shorter and quicker | 0 (bit-wise OR 0) to floor the values, which you should only use for positive integers.
The use of a template string to format the output.
You could also define it as a module and thus avoid the need to encapsulate the constants as a module has its own local scope.