Ejemplo n.º 1
0
 /**
  * If the entity has been saved into the database returns its save date,
  * otherwise null will be returned.
  * (Save date refers to the date of the first insertion and does not consider
  * any successive updates.)
  * @return MongoDate Date
  */
 public function getSaveDate()
 {
     if (!isset($this->_id)) {
         return null;
     }
     return Utils::createMongoDate(0, 0, 0, 0, 0, $this->_id->getTimestamp());
 }
Ejemplo n.º 2
0
 public function testMongoDateToStringReturnsExpectedString()
 {
     $d = Utils::createMongoDate(2000, 5, 5);
     $this->assertEquals(Utils::mongoDateToString($d, 'd-m-Y'), '05-05-2000');
 }