Skip to content

Instantly share code, notes, and snippets.

@nrjones8
Created August 24, 2016 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrjones8/0a625aa8d07c94a582fc1517b04b0b15 to your computer and use it in GitHub Desktop.
Save nrjones8/0a625aa8d07c94a582fc1517b04b0b15 to your computer and use it in GitHub Desktop.
PHP's interpretation of RFC 3339 serialization of a UTC timestamp
<?php
$timezone = new \DateTimeZone('UTC');
$needed_time = new \DateTime('2019-11-06 18:20:56', $timezone);
echo $needed_time->getTimezone()->getName() . "\n";
echo $needed_time->format(DATE_RFC3339) . "\n";
// Output (note the +00:00 instead of "Z")
// UTC
// 2019-11-06T18:20:56+00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment