Normalizes an object implementing the {@see \DateTimeInterface} to a date string.
Denormalizes a date string to an instance of {@see \DateTime} or {@see \DateTimeImmutable}.
- author Kévin Dunglas
CloneableFinalInstantiable
| Constants |
| public Symfony |
| public Symfony |
| public Symfony |
| public Symfony |
| Methods |
| public __construct(array $defaultContext = []) |
public denormalize(?mixed $data, string $type, ?string $format = NULL, array $context = []) : DateTimeInterface
|
| public getSupportedTypes(?string $format) : array |
public normalize(?mixed $data, ?string $format = NULL, array $context = []) : string|int|float
|
| public setDefaultContext(array $defaultContext) : void |
| public supportsDenormalization(?mixed $data, string $type, ?string $format = NULL, array $context = []) : bool |
| public supportsNormalization(?mixed $data, ?string $format = NULL, array $context = []) : bool |
| Constants |
| private Symfony |
| Properties |
| private array $defaultContext = ['datetime_format' => 'Y-m-d\TH:i:sP', 'datetime_timezone' => NULL, 'datetime_cast' => NULL, 'datetime_force_timezone' => false] |
| Methods |
| private enforceTimezone(DateTime|DateTimeImmutable $object, array $context) : DateTimeInterface |
| private formatDateTimeErrors(array $errors) : array Formats datetime errors.
|
| private getTimezone(array $context) : ?DateTimeZone |