Transforms date string to DateTime object

@param object                $modelData
@param PropertyPathInterface $propertyPath
@param mixed                 $value
335800
public function reverseTransform($modelData, PropertyPathInterface $propertyPath, $value)
    {
        if (false === $date = $this->createDateFromString($value)) {
            $date = null;
        }

        $this->propertyAccessor->setValue($modelData, $propertyPath, $date);
    }
371462
protected function parseAsDateTime($value)
    {
        if (empty($value) && !is_numeric($value)) {
            return null;
        }

        if (is_string($value)) {
            try {
                $value = new DateTime($value);
            } catch (Exception $e) {
                throw new InvalidArgumentException(sprintf(
                    'Invalid date/time value: %s',
                    $e->getMessage()
                ), $e->getCode(), $e);
            }
        }

        if (!$value instanceof DateTimeInterface) {
            throw new InvalidArgumentException(
                'Invalid date/time value. Must be a date/time string or an implementation of DateTimeInterface.'
            );
        }

        return $value;
    }
1052451
private static function renderDateTimeValueInstance($event, $value)
    {
        if (!($value instanceof \DateTime)) {
            return;
        }

        $dispatcher = $event->getEnvironment()->getEventDispatcher();

        $event->setRendered(
            self::parseDateTime($dispatcher, self::getConfig()->get('datimFormat'), $value->getTimestamp())
        );
    }
522221
static public function readable($value, $message = null, $propertyPath = null)
        {
            static::string($value, $message);

            if (!is_readable($value)) {
                $message = $message ?: sprintf(
                    'Path "%s" was expected to be readable.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::INVALID_READABLE, $propertyPath);
            }
        }
1045352
protected function serializeAttribute($value, AttributeMetadata $attrMeta)
    {
        if ('date' === $attrMeta->dataType && $value instanceof \DateTime) {
            $milliseconds = sprintf('%03d', round($value->format('u') / 1000, 0));
            return gmdate(sprintf('Y-m-d\TH:i:s.%s\Z', $milliseconds), $value->getTimestamp());
        }
        if ('array' === $attrMeta->dataType && empty($value)) {
            return [];
        }
        if ('object' === $attrMeta->dataType) {
            return (array) $value;
        }
        return $value;
    }
72753
public static function createWith(PropertyEditorAccessor $dataSetter, PropertyPath $propertyPath, $value) : self
    {
        return new self($dataSetter, $propertyPath, $value);
    }
191028
public function dateTimeFieldRow(IFormModel $model, $property, array $options = [])
    {
        $element = $this->getField($model, $property);
        $options['id'] = $element['id'];

        return Html::openTag('div', $this->getBlock('block', $options)).
        Html::label($model->getLabel($property), $element['id'], $this->getBlock('label', $options)).
        $this->dateTimeField($model, $property, $options).
        Html::closeTag('div');
    }
1190781
@SuppressWarnings("unchecked")
    protected <A extends Comparable> DateTimePath<A> createDateTime(String property, Class<? super A> type) {
        return add(new DateTimePath<A>((Class) type, forProperty(property)));
    }
1130414
static public function numeric($value, $message = null, $propertyPath = null)
        {
            if (!is_numeric($value)) {
                $message = $message ?: sprintf(
                    'Value "%s" is not numeric.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::INVALID_NUMERIC, $propertyPath);
            }
        }
333084
protected function transformDataForRepository($modelData)
    {
        foreach ($this->columnTransforms as $columnName => $transforms) {
            if ($transforms[1] !== null) {
                $closure = $transforms[1];

                $transformedData = $closure($modelData);

                if (is_array($transformedData)) {
                    // If the original value is to be retained, the transform function should
                    // explicitly return it - in other cases we need to unset it here.
                    unset($modelData[$columnName]);

                    $modelData = array_merge($modelData, $transformedData);
                } else {
                    $modelData[$columnName] = $transformedData;
                }
            }
        }

        return $modelData;
    }
985523
public function initWithFile($modelPath, $policyPath)
    {
        $adapter = new FileAdapter($policyPath);
        $this->initWithAdapter($modelPath, $adapter);
    }
829800
@SuppressWarnings("unchecked")
    public <A extends Comparable<?>> DatePath<A> getDate(String property, Class<A> type) {
        Class<? extends A> vtype = validate(property, type);
        return super.createDate(property, (Class<? super A>) vtype);
    }
614692
public function prepareModelDataForStatement($modelData)
    {
        $newModelData = [];
        foreach ($modelData as $column) {
            $name = $this->paramTransformer->transform($column['name']);

            switch (true) {
                case is_object($column['value']):
                    switch (true) {
                        case ($column['value'] instanceOf \DateTime):
                            $newModelData[] = [$name, (string) $column['value']->format('Y-m-d H:i:s')];
                            break;
                    }

                    break;
                default:
                    $newModelData[] = [$name, (string) $column['value']];
                    break;
            }

        }

        return $newModelData;
    }
112693
public function dateTimeLocalField(IFormModel $model, $property, array $options = [])
    {
        $element = $this->getField($model, $property);
        $options['id'] = $element['id'];

        return Html::datetimeLocalField($element['name'], $element['value'], $options);
    }
1371583
public function convertToDatabaseValue ($value, AbstractPlatform $platform) {
		if ($value === null) {
			return null;
		}

		$value -> setTimezone(self::getUTCTimeZone());
		return $value -> format($platform -> getDateTimeFormatString());
	}
790736
public static function predict($fieldName, $modelPath)
    {
        $patterns = Config::getKeyPatterns();

        if (Helpers::strIs($patterns, $fieldName)) {
            $relationName = camel_case(Helpers::extractModelName($fieldName));
            $model = Helpers::guessModelFullName($fieldName, $modelPath);
            $parameters = [$model, $fieldName];

            return new self('belongsTo', $parameters, $relationName);
        }

        return null;
    }
678246
@Override
  public DateTime toDate(String filePath, Formatter formatter)
  {
    Integer[] vals = getDateValues(filePath, formatter);
    GranularityType granularityType = GranularityType.fromPeriod(period);

    DateTime date = granularityType.getDateTime(vals);

    if (date != null) {
      return bucketStart(date);
    }

    return null;
  }