Recurr\Rule::setStartDate PHP Method

setStartDate() public method

This date specifies the first instance in the recurrence set.
public setStartDate ( DateTime | null $startDate, boolean | null $includeInString = null )
$startDate DateTime | null Date of the first instance in the recurrence
$includeInString boolean | null If true, include as DTSTART when calling getString()
    public function setStartDate($startDate, $includeInString = null)
    {
        $this->startDate = $startDate;
        if ($includeInString !== null) {
            $this->isStartDateFromDtstart = (bool) $includeInString;
        }
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 public function testSetStartDateAffectsStringOutput()
 {
     $this->rule->loadFromString('FREQ=MONTHLY;COUNT=2');
     $this->assertEquals('FREQ=MONTHLY;COUNT=2', $this->rule->getString());
     $this->rule->setStartDate(new \DateTime('2015-12-10'));
     $this->assertEquals('FREQ=MONTHLY;COUNT=2', $this->rule->getString());
     $this->rule->setStartDate(new \DateTime('2015-12-10'), true);
     $this->assertEquals('FREQ=MONTHLY;COUNT=2;DTSTART=20151210T000000', $this->rule->getString());
     $this->rule->setStartDate(new \DateTime('2015-12-10'), false);
     $this->assertEquals('FREQ=MONTHLY;COUNT=2', $this->rule->getString());
 }
All Usage Examples Of Recurr\Rule::setStartDate