public function getDateToSql() { return $this->date_to ? DateTime2::create($this->date_to)->toStringSql() : $this->date_to; }
public function testReplaceNow() { DateTime2::$manualNow = '2015-05-17 12:15:17'; $date = DateTime2::create(); $this->assertEquals('17.05.2015 12:15:17', $date->toStringRus(true)); $date = new DateTime2(); $this->assertEquals('17.05.2015 12:15:17', $date->toStringRus(true)); $date = DateTime2::create(''); $this->assertEquals('17.05.2015 12:15:17', $date->toStringRus(true)); DateTime2::$manualNow = null; $date = DateTime2::create(); $this->assertNotEquals('17.05.2015 12:15:17', $date->toStringRus(true)); $date = new DateTime2(); $this->assertNotEquals('17.05.2015 12:15:17', $date->toStringRus(true)); $date = DateTime2::create(''); $this->assertNotEquals('17.05.2015 12:15:17', $date->toStringRus(true)); }