config('serialization.settings')->get('bc_timestamp_normalizer_unix')) { return ['value' => $timestamp]; } // Otherwise, format the date string to the same that // \Drupal\serialization\Normalizer\TimestampItemNormalizer will produce. $date = new \DateTime(); $date->setTimestamp($timestamp); $date->setTimezone(new \DateTimeZone('UTC')); // Format is also added to the expected return values. return [ 'value' => $date->format(\DateTime::RFC3339), 'format' => \DateTime::RFC3339, ]; } }