Tools.php
public static function secondsToPrettyTime($seconds, $dayLength = 28800, $weekLength = 144000)
    {
        $minus = $seconds < 0;
        $seconds = (int)abs($seconds);
        if ($seconds === 0) {
            return '0s';
        }

        $out = [];
        $units = ['w' => $weekLength, 'd' => $dayLength, 'h' => 3600, 'm' => 60, 's' => 1];
        foreach ($units as $sign => $value) {
            if ($seconds < $value) {
                continue;
            }

            $i = floor($seconds / $value);
            $out[] = $i . $sign;
            $seconds -= ($i * $value);
        }

        return ($minus ? '-' : '') . implode(' ', $out);
    }
public static function secondsToPrettyTime($seconds, $dayLength = 28800, $weekLength = 144000)
    {
        $minus = $seconds < 0;
        $seconds = (int)abs($seconds);
        if ($seconds === 0) {
            return '0s';
        }

        $out = [];
        $units = ['w' => $weekLength, 'd' => $dayLength, 'h' => 3600, 'm' => 60, 's' => 1];
        foreach ($units as $sign => $value) {
            if ($seconds < $value) {
                continue;
            }

            $i = floor($seconds / $value);
            $out[] = $i . $sign;
            $seconds -= ($i * $value);
        }

        return ($minus ? '-' : '') . implode(' ', $out);
    }
Converts seconds to pretty time format (2w 1d 5h 30m)

@param int $seconds Time in seconds
@param int $dayLength Length of the work day in seconds
@param int $weekLength Length of the work week is seconds
@return string Pretty time format