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); }
/** * @inheritdoc */ protected function parseDateValue($value) { if ($value instanceof UTCDateTime) { return $value->toDateTime()->getTimestamp(); } return parent::parseDateValue($value); }
/** * @inheritdoc */ protected function parseDateValue($value) { if ($this->isInDbFormat($value)) { return strtotime($value); } return parent::parseDateValue($value); }
/** * @inheritdoc */ protected function parseDateValue($value) { if ($value instanceof UTCDateTime) { return (int) $value->__toString(); } return parent::parseDateValue($value); }
/** * @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); }
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; } }