TimestampNormalizer
class TimestampNormalizer extends DateTimeNormalizer (View source)
| internal | Note that \Drupal\Core\TypedData\Plugin\DataType\Timestamp::getDateTime() explicitly sets a default timezone of UTC. This ensures the string representation generated by DateTimeNormalizer::normalize() is also in UTC. |
Converts values for the Timestamp data type to and from common formats.
Traits
Properties
| protected | $supportedInterfaceOrClass | {@inheritdoc} | |
| protected string|string[] | $format | List of formats which supports (de-)normalization. |
from NormalizerBase |
| protected | $allowedFormats | {@inheritdoc} | |
| protected ImmutableConfig | $systemDateConfig | The system's date configuration. |
from DateTimeNormalizer |
Methods
Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()
Checks if the provided format is supported by this normalizer.
Gets the timezone to be used during normalization.
{@inheritdoc}
Details
supportsNormalization($data, $format = NULL)
{@inheritdoc}
supportsDenormalization($data, $type, $format = NULL)
Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()
This class doesn't implement DenormalizerInterface, but most of its child classes do. Therefore, this method is implemented at this level to reduce code duplication.
protected bool
checkFormat(string $format = NULL)
Checks if the provided format is supported by this normalizer.
protected
addCacheableDependency(array $context, $data)
Adds cacheability if applicable.
__construct(ConfigFactoryInterface $config_factory)
Constructs a new DateTimeNormalizer instance.
normalize($datetime, $format = NULL, array $context = [])
{@inheritdoc}
protected
getNormalizationTimezone()
Gets the timezone to be used during normalization.
denormalize($data, $class, $format = NULL, array $context = [])
{@inheritdoc}