Author: Chuck Hagenbuch (chuck@horde.org)
示例#1
0
 public function testSpanMath()
 {
     $s = new Horde_Date_Span(new Horde_Date(1), new Horde_Date(2));
     $this->assertEquals(2, $s->add(1)->begin->timestamp());
     $this->assertEquals(3, $s->add(1)->end->timestamp());
     $this->assertEquals(0, $s->sub(1)->begin->timestamp());
     $this->assertEquals(1, $s->sub(1)->end->timestamp());
 }
示例#2
0
 public function testDateMath()
 {
     $d = new Horde_Date('2008-01-01 00:00:00');
     $this->assertEquals('2007-12-31 00:00:00', (string) $d->sub(array('day' => 1)));
     $this->assertEquals('2009-01-01 00:00:00', (string) $d->add(array('year' => 1)));
     $this->assertEquals('2008-01-01 04:00:00', (string) $d->add(14400));
     $span = new Horde_Date_Span('2006-01-01 00:00:00', '2006-08-16 00:00:00');
     $this->assertEquals('2006-04-24 11:30:00', (string) $span->begin->add($span->width() / 2));
 }