parseDateValue() protected method

Parses date string into UNIX timestamp
protected parseDateValue ( string $value ) : integer | false
$value string string representing date
return integer | false a UNIX timestamp or `false` on failure.
 /**
  * @inheritdoc
  */
 protected function parseDateValue($value)
 {
     if ($value instanceof \MongoDate) {
         return $value->sec;
     }
     return parent::parseDateValue($value);
 }
Exemplo n.º 2
0
 /**
  * @inheritdoc
  */
 protected function parseDateValue($value)
 {
     if ($value instanceof UTCDateTime) {
         return $value->toDateTime()->getTimestamp();
     }
     return parent::parseDateValue($value);
 }
Exemplo n.º 3
0
 /**
  * @inheritdoc
  */
 protected function parseDateValue($value)
 {
     if ($this->isInDbFormat($value)) {
         return strtotime($value);
     }
     return parent::parseDateValue($value);
 }
Exemplo n.º 4
0
 /**
  * @inheritdoc
  */
 protected function parseDateValue($value)
 {
     if ($value instanceof UTCDateTime) {
         return (int) $value->__toString();
     }
     return parent::parseDateValue($value);
 }
Exemplo n.º 5
0
 /**
  * @inheritdoc
  */
 protected function parseDateValue($value)
 {
     if ($value instanceof \MongoDB\BSON\UTCDatetime) {
         /** @var \DateTime $datetime */
         $datetime = $value->toDateTime();
         return $datetime->format('U');
     }
     return parent::parseDateValue($value);
 }
Exemplo n.º 6
0
 protected function parseDateValue($value)
 {
     if ($value instanceof \MongoDate) {
         return $value;
     }
     $ts = parent::parseDateValue($value);
     if (!$ts) {
         return false;
     }
     if ($this->cast) {
         return new \MongoDate($ts);
     } else {
         return $ts;
     }
 }