public static function getIntervalFromSeconds($seconds)
    {
        // don't care about micro-seconds.
        $seconds = floor(abs($seconds));

        $minute = 60;
        $hour = $minute * 60;
        $day = $hour * 24;
        $month = $day * 30;
        $year = $day * 365;

        $interval_spec = 'P';

        if ($seconds > $year) {
            $years = floor($seconds / $year);
            $seconds -= $year * $years;
            $interval_spec .= $years . 'Y';
        }

        if ($seconds > $month) {
            $months = floor($seconds / $month);
            $seconds -= $month * $months;
            $interval_spec .= $months . 'M';
        }

        if ($seconds > $day) {
            $days = floor($seconds / $day);
            $seconds -= $day * $days;
            $interval_spec .= $days . 'D';
        }

        if ($seconds > 0 || $interval_spec === 'P') {
            $interval_spec .= 'T';

            if ($seconds > $hour) {
                $hours = floor($seconds / $hour);
                $seconds -= $hour * $hours;
                $interval_spec .= $hours . 'H';
            }

            if ($seconds > $minute) {
                $minutes = floor($seconds / $minute);
                $seconds -= $minute * $minutes;
                $interval_spec .= $minutes . 'M';
            }

            $interval_spec .= $seconds . 'S';
        }

        return new DateInterval($interval_spec);
    }