function dateCompare($d1, $d2) { $d1 = clone $d1; // shallow copy $d1->setTime(0, 0, 0); $d2 = clone $d2; // shallow copy $d2->setTime(0, 0, 0); return datetimeCompare($d1, $d2); }
/** * This method compares stationid, then startTime, then stopTime, then title */ public function compare($otherStation) { if ($this->stationid == $otherStation->stationid) { return 0; } if ($this->expoid != $otherStation->expoid) { return 1000; } // ensuring NOT equal // note ASCending order $dc = datetimeCompare($otherStation->startTime, $this->startTime); if (0 != $dc) { return $dc; } // note ASCending order $dc = datetimeCompare($otherStation->stopTime, $this->stopTime); if (0 != $dc) { return $dc; } return strcmp($this->stationTitle, $otherStation->stationTitle); }
public function compare($otherStation) { if ($this->stationid == $otherStation->stationid) { return 0; } $dc = datetimeCompare($this->startTime, $otherStation->startTime); if (0 != $dc) { return $dc; } $dc = datetimeCompare($this->stopTime, $otherStation->stopTime); if (0 != $dc) { return $dc; } $c = strcasecmp($this->location, $otherStation->location); if (0 != $c) { return $c; } return strcmp($this->stationTitle, $otherStation->stationTitle); }
public function compare($otherJob) { if ($this->jobid == $otherJob->jobid) { return 0; } // note ASCending order $dc = datetimeCompare($this->startTime, $otherJob->startTime); if (0 != $dc) { return $dc; } // note ASCending order $dc = datetimeCompare($this->stopTime, $otherJob->stopTime); if (0 != $dc) { return $dc; } $c = strcasecmp($this->location, $otherJob->location); if (0 != $c) { return $c; } return strcmp($this->jobTitle, $otherJob->jobTitle); }