Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DateTime.php

function DateTime::__construct

Parameters

non-empty-string|array<string,mixed>|null $format The datetime format to match (defaults to 'Y-m-d H:i:s'):

string[]|null $groups:

array<string,mixed> $options:

Overrides Constraint::__construct

File

vendor/symfony/validator/Constraints/DateTime.php, line 44

Class

DateTime
Validates that a value is a valid "datetime" according to a given format.

Namespace

Symfony\Component\Validator\Constraints

Code

public function __construct(string|array|null $format = null, ?string $message = null, ?array $groups = null, mixed $payload = null, array $options = []) {
    if (\is_array($format)) {
        $options = array_merge($format, $options);
    }
    elseif (null !== $format) {
        $options['value'] = $format;
    }
    parent::__construct($options, $groups, $payload);
    $this->message = $message ?? $this->message;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal