DatePeriod::getEndDate
(PHP 5 >= 5.6.5, PHP 7, PHP 8)
DatePeriod::getEndDate —
Gets the end date
Description
Object-oriented style
Parameters
This function has no parameters.
Examples
Example #1 DatePeriod::getEndDate() example
<?php
$period = new DatePeriod(
new DateTime('2016-05-16T00:00:00Z'),
new DateInterval('P1D'),
new DateTime('2016-05-20T00:00:00Z')
);
$start = $period->getEndDate();
echo $start->format(DateTime::ISO8601);
The above examples will output:
Example #2 DatePeriod::getEndDate() without an end date
<?php
$period = new DatePeriod(
new DateTime('2016-05-16T00:00:00Z'),
new DateInterval('P1D'),
7
);
var_dump($period->getEndDate());
The above example will output: