You are here

public function Carbon::between in Persian Date for Drupal 8 8.4

Determines if the instance is between two others

Parameters

Carbon $dt1:

Carbon $dt2:

bool $equal Indicates if a > and < comparison should be used or <= or >=:

Return value

bool

File

src/Library/Carbon/Carbon.php, line 1564

Class

Carbon
A simple API extension for DateTime

Namespace

Drupal\persian_date\Library\Carbon

Code

public function between(Carbon $dt1, Carbon $dt2, $equal = true) {
  if ($dt1
    ->gt($dt2)) {
    $temp = $dt1;
    $dt1 = $dt2;
    $dt2 = $temp;
  }
  if ($equal) {
    return $this
      ->gte($dt1) && $this
      ->lte($dt2);
  }
  return $this
    ->gt($dt1) && $this
    ->lt($dt2);
}