PHP | DatePeriod getEndDate() Function Last Updated : 12 Feb, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The DatePeriod::getEndDate() function is an inbuilt function in PHP which is used to return the end date. If the given date period does not have any end date then it returns NULL.Syntax: DateTimeInterface DatePeriod::getEndDate( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the end date of the given date period. Below programs illustrate the DatePeriod::getEndDate() function in PHP:Program 1: php <?php // Initialising a startDate with time $StartDate = new DateTime('2019-09-30T00:00:00Z'); // Initialising a DateInterval of 2 day $DateInterval = new DateInterval('P2D'); // Initialising a endDate with time $EndDate = new DateTime('2019-10-02T00:00:00Z'); // Initialising a DatePeriod with startDate, DateInterval and // endDate $datePeriod = new DatePeriod( $StartDate, $DateInterval, $EndDate); // Calling the getendDate() function $endDate = $datePeriod->getEndDate(); // Getting the start date echo $endDate->format(DateTime::ISO8601); ?> Output: 2019-10-02T00:00:00+0000 Program 2: php <?php // Initialising a startDate with time $StartDate = new DateTime('2019-09-30T00:00:00Z'); // Initialising a DateInterval of 2 day $DateInterval = new DateInterval('P2D'); // Initialising a DatePeriod with startDate, DateInterval // and without endDate $datePeriod = new DatePeriod( $StartDate, $DateInterval, 7); // Getting the start date var_dump($datePeriod->getEndDate()); ?> Output: NULL Reference: https://www.php.net/manual/en/dateperiod.getenddate.php Comment More infoAdvertise with us Next Article PHP | date_get_last_errors() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-date-time PHP-function Similar Reads PHP | DatePeriod getStartDate() Function The DatePeriod::getStartDate() function is an inbuilt function in PHP which is used to return the start date of the given date period. Syntax: DateTimeInterface DatePeriod::getStartDate( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the start da 1 min read PHP | DatePeriod getDateInterval() Function The DatePeriod::getDateInterval() function is an inbuilt function in PHP which is used to return the date interval for the given date period. Syntax: DateInterval DatePeriod::getDateInterval( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the Dat 1 min read PHP | date_get_last_errors() Function The date_get_last_errors() function is an inbuilt function in PHP which is used to returns the warnings and errors. This function parse a date/time string and returns an array of warnings and errors. Syntax: Procedural style: array date_get_last_errors( void ) Object oriented style: array DateTime:: 1 min read PHP | getdate() Function The getdate() function is an inbuilt function in PHP which is used to get date/time information of the current local date/time. Syntax: getdate($timestamp) Parameters: The getdate() function accepts one parameter and it is described below: $timestamp: It is an optional parameter which specifies an i 2 min read PHP | date_offset_get() Function The date_offset_get() function is an inbuilt function in PHP which is used to returns the timezone offset. This function returns the timezone offset in seconds from UTC (Universal Time Coordinated) on success or FALSE on failure. Syntax: Procedural Style: int date_offset_get( $object ) Object Orient 1 min read PHP | IntlCalendar after() Function The IntlCalendar::after() function is an inbuilt function in PHP which returns True if the object time is after that of the passed object. Syntax: Object oriented style:bool IntlCalendar::after( IntlCalendar $other )Procedural style:bool intlcal_after( IntlCalendar $cal, IntlCalendar $other ) Parame 1 min read Like