src/Api/DateTimeImmutable.php
public function formatForJson(): string
    {
        $date = $this->setTimezone(new \DateTimeZone('Etc/UTC'));
        $result = $date->format('Y-m-d\TH:i:s');
        $milliseconds = \floor($date->format('u') / 1000);

        if ($milliseconds > 0) {
            $result .= '.'.\str_pad((string) $milliseconds, 3, '0', \STR_PAD_LEFT);
        }

        return $result.'Z';
    }
public function formatForJson(): string
    {
        $date = $this->setTimezone(new \DateTimeZone('Etc/UTC'));
        $result = $date->format('Y-m-d\TH:i:s');
        $milliseconds = \floor($date->format('u') / 1000);

        if ($milliseconds > 0) {
            $result .= '.'.\str_pad((string) $milliseconds, 3, '0', \STR_PAD_LEFT);
        }

        return $result.'Z';
    }
public function formatForJson ( ) : string { $ date = $ this -> setTimezone ( new \ DateTimeZone ( 'Etc/UTC' ) ) ; $ result = $ date -> format ( 'Y-m-d\TH:i:s' ) ; $ milliseconds = \ floor ( $ date -> format ( 'u' ) / 1000 ) ; if ( $ milliseconds > 0 ) { $ result .= '.' . \ str_pad ( ( string ) $ milliseconds , 3 , '0' , \ STR_PAD_LEFT ) ; } return $ result . 'Z' ; }
Formats the string for an easier interoperability with Contentful.

@return string
Formats the string for an easier interoperability with Contentful .