protected function parseReferenceDate($referenceDateString)
    {
        $referenceDateParts = explode('/', $referenceDateString, 2);

        if (count($referenceDateParts) === 1) {
            // assume a valid Date/Time string
            return new \DateTime($referenceDateParts[0]);
        }
        // check if the period (the interval) is the first or second item:
        if (strpos($referenceDateParts[0], 'P') === 0) {
            $interval = new \DateInterval($referenceDateParts[0]);
            $date = new \DateTime($referenceDateParts[1]);
            return $date->sub($interval);
        } elseif (strpos($referenceDateParts[1], 'P') === 0) {
            $interval = new \DateInterval($referenceDateParts[1]);
            $date = new \DateTime($referenceDateParts[0]);
            return $date->add($interval);
        } else {
            throw new InvalidValidationOptionsException(sprintf('There is no valid interval declaration in "%s". Exactly one part must begin with "P".', $referenceDateString), 1324314462);
        }
    }
protected function parseReferenceDate($referenceDateString)
    {
        $referenceDateParts = explode('/', $referenceDateString, 2);

        if (count($referenceDateParts) === 1) {
            // assume a valid Date/Time string
            return new \DateTime($referenceDateParts[0]);
        }
        // check if the period (the interval) is the first or second item:
        if (strpos($referenceDateParts[0], 'P') === 0) {
            $interval = new \DateInterval($referenceDateParts[0]);
            $date = new \DateTime($referenceDateParts[1]);
            return $date->sub($interval);
        } elseif (strpos($referenceDateParts[1], 'P') === 0) {
            $interval = new \DateInterval($referenceDateParts[1]);
            $date = new \DateTime($referenceDateParts[0]);
            return $date->add($interval);
        } else {
            throw new InvalidValidationOptionsException(sprintf('There is no valid interval declaration in "%s". Exactly one part must begin with "P".', $referenceDateString), 1324314462);
        }
    }
protected function parseReferenceDate ( $ referenceDateString ) { $ referenceDateParts = explode ( '/' , $ referenceDateString , 2 ) ; if ( count ( $ referenceDateParts ) === 1 ) { // assume a valid Date/Time string return new \ DateTime ( $ referenceDateParts [ 0 ] ) ; } // check if the period (the interval) is the first or second item: if ( strpos ( $ referenceDateParts [ 0 ] , 'P' ) === 0 ) { $ interval = new \ DateInterval ( $ referenceDateParts [ 0 ] ) ; $ date = new \ DateTime ( $ referenceDateParts [ 1 ] ) ; return $ date -> sub ( $ interval ) ; } elseif ( strpos ( $ referenceDateParts [ 1 ] , 'P' ) === 0 ) { $ interval = new \ DateInterval ( $ referenceDateParts [ 1 ] ) ; $ date = new \ DateTime ( $ referenceDateParts [ 0 ] ) ; return $ date -> add ( $ interval ) ; } else { throw new InvalidValidationOptionsException ( sprintf ( 'There is no valid interval declaration in "%s". Exactly one part must begin with "P".' , $ referenceDateString ) , 1324314462 ) ; } }
Calculates a DateTime object from a given Time interval

@param string $referenceDateString being one of <time>, <start>/<offset> or <offset>/<end>
@return \DateTime
@throws InvalidValidationOptionsException
@see isValid()
Calculates a DateTime object from a given Time interval