Neos\Neos\Service\Mapping\DateStringConverter::convertFrom PHP Method

convertFrom() public method

public convertFrom ( DateTime $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : string
$source DateTime
$targetType string
$convertedChildProperties array
$configuration Neos\Flow\Property\PropertyMappingConfigurationInterface
return string the target type
    public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = null)
    {
        if (!$source instanceof \DateTime) {
            return null;
        }
        $value = clone $source;
        return $value->setTimezone(new \DateTimeZone('UTC'))->format(\DateTime::W3C);
    }
DateStringConverter