PHP code example of salamek / php-daterange

1. Go to this page and download the library: Download salamek/php-daterange library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

salamek / php-daterange example snippets




$dateRange = new Salamek\DateRange(\DateTimeInterface $startDate, \DateTimeInterface $endDate);

$dateRange->getStartDate(); //$startDate
$dateRange->getEndDate(); //$endDate
$datePeriod = $dateRange->datePeriod(\DateInterval $dateInterval); // same as \DatePeriod(\DateTimeInterface $startDate, \DateInterval $dateInterval, \DateTimeInterface $endDate)