1. Go to this page and download the library: Download daffox/datetimerange 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/ */
daffox / datetimerange example snippets
use Carbon\Carbon;
use Daffox\DateTimeRange\DateTimeRange;
$dt_range_start = Carbon::create(2016, 4, 19);
$dt_range_end = Carbon::create(2016, 4, 25);
$dt_to_check = Carbon::create(2016, 4, 20);
$range = DateTimeRange::create($dt_range_start, $dt_range_end);
// checks value between range
$is_in_range = $range->isInRange($dt_to_check);
// checks value between range: including start and till end
$is_in_range_including_start = $range->isInRangeIncStart($dt_to_check);
// checks value between range: from start to end (including it)
$is_in_range_including_end = $range->isInRangeIncEnd($dt_to_check);
// checks value between range: including start and till end (including it)
$is_in_range_including_both = $range->isInRangeIncBoth($dt_to_check);
use Daffox\DateTimeRange\DateTimeRange;
$dt_range_start = new DateTime('2016-04-19 10:00');
$dt_range_end = new DateTime('2016-04-25 17:00');
$dt_to_check = new DateTime('2016-04-25 16:30');
$range = DateTimeRange::create($dt_range_start, $dt_range_end);
// checks value between range
$is_in_range = $range->isInRange($dt_to_check);
// checks value between range: including start and till end
$is_in_range_including_start = $range->isInRangeIncStart($dt_to_check);
// checks value between range: from start to end (including it)
$is_in_range_including_end = $range->isInRangeIncEnd($dt_to_check);
// checks value between range: including start and till end (including it)
$is_in_range_including_both = $range->isInRangeIncBoth($dt_to_check);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.