Esempio n. 1
0
File: Date.php Progetto: hmlb/date
 /**
  * Determines if the instance is between two others.
  *
  * @param Date $dt1
  * @param Date $dt2
  * @param bool $equal Indicates if a > and < comparison should be used or <= or >=
  *
  * @return bool
  */
 public function isBetween(Date $dt1, Date $dt2, $equal = true)
 {
     if ($dt1->isAfter($dt2)) {
         $temp = $dt1;
         $dt1 = $dt2;
         $dt2 = $temp;
     }
     if ($equal) {
         return $this->isAfterOrEquals($dt1) && $this->isBeforeOrEquals($dt2);
     }
     return $this->isAfter($dt1) && $this->isBefore($dt2);
 }