@param $serializedValue

@return \DateTimeInterface
@throws InvalidArgumentException
500238
public function deserialize($serializedValue)
    {
        if (null === $serializedValue && $this->isNullable()) {
            return ($this->default === null) ? null : $this->default;
        }

        if (!is_string($serializedValue)) {
            throw InvalidArgumentException::expected('string', $serializedValue);
        }

        return new \DateTimeImmutable($serializedValue);
    }
1260638
protected function createValueFromInput( $inputValue )
    {
        if ( is_array( $inputValue ) )
        {
            foreach ( $inputValue as $index => $inputValueItem )
            {
                if ( !$inputValueItem instanceof Meta )
                {
                    throw new InvalidArgumentType(
                        '$inputValue[' . $index . ']',
                        "\\Novactive\\Bundle\\SEOBundle\\API\\Repository\\Values\\Metas\\Meta",
                        $inputValueItem
                    );
                }
            }
            $inputValue = new Value( $inputValue );
        }

        return $inputValue;
    }
957608
public function formatDateNever($dateValue)
    {
        if ($dateValue) {
            return $this->formatDateTime($dateValue);
        } else {
            return \MUtil_Html::create()->span($this->_('never'), array('class' => 'disabled'));
        }
    }
1198231
private static function getTimeValue($timeValue)
    {
        $saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType();
        PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
        $timeValue = self::TIMEVALUE($timeValue);
        PHPExcel_Calculation_Functions::setReturnDateType($saveReturnDateType);
        return $timeValue;
    }
1300624
private function _processDateTime($dateTime)
    {
        if (is_numeric($dateTime)) {
            $timestamp = $dateTime;
            $dateTime = new \DateTime();
            $dateTime->setTimestamp($timestamp);
        } elseif (empty($dateTime)) {
            throw new \InvalidArgumentException('Date/time is empty');
        } elseif (is_string($dateTime)) {
            $dateTime = new \DateTime($dateTime);
        }

        if (!($dateTime instanceof \DateTime)) {
            throw new \InvalidArgumentException('Incorrect date/time type');
        }
        return $dateTime;
    }
782869
public function normalize($object, $format = null, array $context = [])
    {
        if (!$object instanceof \DateInterval) {
            throw new InvalidArgumentException('The object must be an instance of "\DateInterval".');
        }

        return $object->format($context[self::FORMAT_KEY] ?? $this->defaultContext[self::FORMAT_KEY]);
    }
204410
public function asGeneralizedTime(): Primitive\GeneralizedTime
    {
        if (!$this->_element instanceof Primitive\GeneralizedTime) {
            throw new \UnexpectedValueException(
                $this->_generateExceptionMessage(Element::TYPE_GENERALIZED_TIME));
        }
        return $this->_element;
    }
871700
protected function createMaximumDateTimeConstraint(Value\ConcreteValueInterface $value)
    {
        if ($value instanceof Value\DateTimeValue) {
            return new DateTimeValue\MaximumDateTimeConstraint($value->value());
        }

        return new DateTimeValue\MaximumDateTimeConstraint(
            new DateTime($value->value())
        );
    }
102742
protected static function convertToType ($rawValue, $typeStr) {
		$conversionResult = FALSE;
		$typeStr = trim($typeStr, '\\');
		if ($typeStr == 'DateTime') {
			$dateTimeFormat = 'Y-m-d H:i:s';
			if (is_numeric($rawValue)) {
				$rawValueStr = str_replace(['+','-','.'], '', strval($rawValue));
				$secData = mb_substr($rawValueStr, 0, 10);
				$dateTimeStr = date($dateTimeFormat, intval($secData));
				if (strlen($rawValueStr) > 10) 
					$dateTimeStr .= '.' . mb_substr($rawValueStr, 10);
			} else {
				$dateTimeStr = strval($rawValue);
				if (strpos($dateTimeStr, '-') === FALSE) {
					$dateTimeFormat = substr($dateTimeFormat, 6);
				} else if (strpos($dateTimeStr, ':') === FALSE) {
					$dateTimeFormat = substr($dateTimeFormat, 0, 5);
				}
				if (strpos($dateTimeStr, '.') !== FALSE) $dateTimeFormat .= '.u';
			}
			$dateTime = date_create_from_format($dateTimeFormat, $dateTimeStr);
			if ($dateTime !== FALSE) {
				$rawValue = $dateTime;
				$conversionResult = TRUE;
			}
		} else {
			if (settype($rawValue, $typeStr)) $conversionResult = TRUE;
		}
		return [$conversionResult, $rawValue];
	}
687021
private function normaliseDateTime($value)
    {
        $value = trim($value);
        switch (true) {
            case (null === $value):
                return $value;
        }
        throw new \RuntimeException('Invalid DateTime default value: ' . $value);
    }
1124203
public function unserialize($serialized)
    {
        $serialized = @unserialize($serialized);
        if (!is_array($serialized)) {
            throw new \InvalidArgumentException(
                'Invalid argument 1, arguments must be serialized of array.',
                E_USER_ERROR
            );
        }

        $this->replace($serialized);
    }
204634
public function buildDateTime($value)
    {
        if ($value instanceof \DateTime) {
            return $value->format(static::DATE_TIME_FORMAT);
        } elseif (is_int($value)) {
            $date = new \DateTime();
            $date->setTimestamp($value);

            return $date->format(static::DATE_TIME_FORMAT);
        } elseif (is_string($value)) {
            $date = new \DateTime($value);

            return $date->format(static::DATE_TIME_FORMAT);
        }
        throw new \InvalidArgumentException('DateTime value should be int, string or \DateTime');
    }
1200924
protected function getNativeTime($value)
    {
        if (is_numeric($value)) {
            $date = new DateTime("@{$value}");
        } else {
            try {
                $date = new DateTime($value);
            } catch (Exception $e) {
                throw new InvalidArgumentException('Invalid date provided: ' . $value);
            }
        }

        return $date->format('Y-m-d\\TH:i:s\\Z');
    }
723099
public static function unserialize(Serializer $serializer, $className, array $value)
    {
        $dateTimeZone = DateTimeZoneSerializer::unserialize(
            $serializer,
            'DateTimeZone',
            array($serializer->unserialize($value['data']['timezone']))
        );

        $ref = new ReflectionClass($className);

        return $ref->newInstanceArgs(
            array($serializer->unserialize($value['data']['date']), $dateTimeZone)
        );
    }
138820
protected function serializedValue($val)
    {
        if (is_scalar($val)) {
            return $val;
        } elseif ($val instanceof DateTimeInterface) {
            return $val->format('Y-m-d H:i:s');
        } else {
            return json_decode(json_encode($val), true);
        }
    }
225657
public function formatDateNa($dateValue)
    {
        if ($dateValue) {
            return $this->formatDateTime($dateValue);
        } else {
            return \MUtil_Html::create()->span($this->_('n/a'), array('class' => 'disabled'));
        }
    }
47513
protected function normalizeValue($value)
    {
        $normalizedValue = $value;
        // object value
        if (is_object($value)) {
            if (get_class($value) === "DateTime") {
                $normalizedValue = $value->format("Y-m-d\TH:i:s.u\Z");
            } elseif ($value instanceof DataContainerInterface || method_exists($value, 'normalizeData')) {
                $normalizedValue = $value->normalizeData();
            } else {
                throw new PropertyValueNormalizationException(
                    "Value error: object of type [" . get_class($value) . "]
                    does not implement DataContainerInterface nor have a [normalizeData] method"
                );
            }
        } elseif (is_array($value)) {
            foreach ($value as $arrProperty => $arrValue) {
                $normalizedValue[$arrProperty] = $this->normalizeValue($arrValue);
            }
        }

        return $normalizedValue;
    }