public function hourDiff() { $this->assertEquals(0, DateMath::diff(\util\TimeInterval::$HOURS, new \util\Date('2007-08-12 12:00:00'), new \util\Date('2007-08-12 12:59:59'))); $this->assertEquals(1, DateMath::diff(\util\TimeInterval::$HOURS, new \util\Date('2007-08-12 12:00:00'), new \util\Date('2007-08-12 13:00:00'))); $this->assertEquals(-1, DateMath::diff(\util\TimeInterval::$HOURS, new \util\Date('2007-08-12 12:00:00'), new \util\Date('2007-08-12 11:59:59'))); }
public function diff($type, $strdate1, $strdate2) { return DateMath::diff(Enum::valueOf(XPClass::forName('util.TimeInterval'), strtoupper($type)), new Date($strdate1), new Date($strdate2)); }