Convert seconds to days, hours, minutes, seconds

seconds = totalSeconds; minutes = floor(seconds / 60); hours = floor(minutes / 60); days = floor(hours / 24);          seconds %= 60; minutes %= 60; hours %= 24;