private function dateIntervalToIntervalSpec(DateInterval $interval)
    {
        $date = sprintf('%uY%uM%uD', $interval->y, $interval->m, $interval->d);
        $time = sprintf('%uH%uM%uS', $interval->h, $interval->i, $interval->s);

        // build extra spec
        $extra = '';
        if ($interval->invert) {
            $extra .= 'I';
        }

        if ($interval->days) {
            $extra .= $interval->days . 'D';
        }

        if (strlen($extra) > 0) {
            $extra = '-' . $extra;
        }

        return sprintf('P%sT%s%s', $date, $time, $extra);
    }
private function dateIntervalToIntervalSpec(DateInterval $interval)
    {
        $date = sprintf('%uY%uM%uD', $interval->y, $interval->m, $interval->d);
        $time = sprintf('%uH%uM%uS', $interval->h, $interval->i, $interval->s);

        // build extra spec
        $extra = '';
        if ($interval->invert) {
            $extra .= 'I';
        }

        if ($interval->days) {
            $extra .= $interval->days . 'D';
        }

        if (strlen($extra) > 0) {
            $extra = '-' . $extra;
        }

        return sprintf('P%sT%s%s', $date, $time, $extra);
    }
private function dateIntervalToIntervalSpec ( DateInterval $ interval ) { $ date = sprintf ( '%uY%uM%uD' , $ interval -> y , $ interval -> m , $ interval -> d ) ; $ time = sprintf ( '%uH%uM%uS' , $ interval -> h , $ interval -> i , $ interval -> s ) ; // build extra spec $ extra = '' ; if ( $ interval -> invert ) { $ extra .= 'I' ; } if ( $ interval -> days ) { $ extra .= $ interval -> days . 'D' ; } if ( strlen ( $ extra ) > 0 ) { $ extra = '-' . $ extra ; } return sprintf ( 'P%sT%s%s' , $ date , $ time , $ extra ) ; }
Create a Dateinterval spec from DateInterval properties

@param DateInterval $interval

@return string
Create a Dateinterval spec from DateInterval properties