Exemplo n.º 1
0
 /**
  * @test
  */
 function use_Diff_directly()
 {
     $d0 = DateTime::createDate('2015', '03', '04');
     $d1 = DateTime::createDate('2016', '04', '07');
     $this->assertEquals(1, Diff::start($d0)->inYears($d1));
     $this->assertEquals(13, Diff::start($d0)->inMonths($d1));
 }
Exemplo n.º 2
0
 /**
  * @test
  */
 function leapYear()
 {
     $d1 = DateTime::createDate('2020');
     $this->assertTrue($d1->is->leapYear());
     $d2 = DateTime::createDate('2021');
     $this->assertFalse($d2->is->leapYear());
 }
Exemplo n.º 3
0
 /**
  * @test
  */
 function createEndOfMonth()
 {
     $dt = DateTime::createEndOfMonth('2015', '3');
     $this->assertEquals('2015-03-31 00:00:00', $dt->format('Y-m-d H:i:s'));
     $dt = DateTime::createEndOfMonth('2015', '3', true);
     $this->assertEquals('2015-03-31 23:59:59', $dt->format('Y-m-d H:i:s'));
 }