Example #1
0
 public function setUsingPgsqlValue($val)
 {
     if (is_null($val)) {
         return null;
     }
     $this->_parameterValue = \DateTime::createFromFormat("Y-m-d|+", "{$val} ");
     // Add a space to the date in order to satisfy + char
 }
Example #2
0
 public function setUsingPgsqlValue($val)
 {
     if (is_null($val)) {
         return null;
     }
     if (preg_match("/\\.[0-9]{1,6}\$/", $val)) {
         $this->_parameterValue = \DateTime::createFromFormat("Y-m-d H:i:s.u", $val);
     } else {
         $this->_parameterValue = \DateTime::createFromFormat("Y-m-d H:i:s", $val);
     }
 }
Example #3
0
 public function testSetUsingPgsqlValue()
 {
     $j = new DateTime(":test");
     $j->setUsingPgsqlValue('2015-09-03 23:12:35');
     $this->assertEquals(new \DateTime("2015-09-03 23:12:35"), $j->getParameterValue(), "Testing datetime decoding from postgres value");
 }