public function transform($dateTime): ?int
    {
        if (null === $dateTime) {
            return null;
        }

        if (!$dateTime instanceof \DateTimeInterface) {
            throw new TransformationFailedException('Expected a \DateTimeInterface.');
        }

        return $dateTime->getTimestamp();
    }
public function transform($dateTime): ?int
    {
        if (null === $dateTime) {
            return null;
        }

        if (!$dateTime instanceof \DateTimeInterface) {
            throw new TransformationFailedException('Expected a \DateTimeInterface.');
        }

        return $dateTime->getTimestamp();
    }
public function transform ( $ dateTime ) : ? int { if ( null === $ dateTime ) { return null ; } if ( ! $ dateTime instanceof \ DateTimeInterface ) { throw new TransformationFailedException ( 'Expected a \DateTimeInterface.' ) ; } return $ dateTime -> getTimestamp ( ) ; }
Transforms a DateTime object into a timestamp in the configured timezone.

@param \DateTimeInterface|null $dateTime

@throws TransformationFailedException If the given value is not a \DateTimeInterface

@return int|null A timestamp
Transforms a DateTime object into a timestamp in the configured timezone .