here is is an example function.
let days = Math.floor(msg.payload / 86400000);
let hours = Math.floor(msg.payload / 3600000) % 24;
let minutes = Math.floor(msg.payload / 60000) % 60;
let seconds = Math.round((msg.payload % 60000) /1000);
msg.payload = `${days}d ${hours}h ${minutes}m ${seconds}s`;
return msg;