public function transform($dateTime)
    {
        if (null === $dateTime) {
            return '';
        }

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

        if (!$dateTime instanceof \DateTimeImmutable) {
            $dateTime = clone $dateTime;
        }

        $dateTime = $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));

        return $dateTime->format($this->generateFormat);
    }
public function transform($dateTime)
    {
        if (null === $dateTime) {
            return '';
        }

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

        if (!$dateTime instanceof \DateTimeImmutable) {
            $dateTime = clone $dateTime;
        }

        $dateTime = $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));

        return $dateTime->format($this->generateFormat);
    }
public function transform ( $ dateTime ) { if ( null === $ dateTime ) { return '' ; } if ( ! $ dateTime instanceof \ DateTimeInterface ) { throw new TransformationFailedException ( 'Expected a \DateTimeInterface.' ) ; } if ( ! $ dateTime instanceof \ DateTimeImmutable ) { $ dateTime = clone $ dateTime ; } $ dateTime = $ dateTime -> setTimezone ( new \ DateTimeZone ( $ this -> outputTimezone ) ) ; return $ dateTime -> format ( $ this -> generateFormat ) ; }
Transforms a DateTime object into a date string with the configured format
and timezone.

@param \DateTimeInterface $dateTime A DateTimeInterface object

@return string A value as produced by PHP's date() function

@throws TransformationFailedException If the given value is not a \DateTimeInterface
Transforms a DateTime object into a date string with the configured format and timezone .