NotionCommotion Posted August 21, 2020 Share Posted August 21, 2020 What are the differences and implications of UTC time and Zulu time? <?php function getArr(string $time):array { $dateTime = new \DateTime($time); return [ 'time'=>$time, 'timestamp'=> $dateTime->getTimestamp(), 'dateTime' => $dateTime ]; } $arr = getArr('2020-08-05'); $arr_z = getArr('2020-08-05T00:00:00Z'); print_r($arr); print_r($arr_z); echo('equal timestamps: '.($arr['timestamp'] === $arr['timestamp']?'true':'false')); Array ( [time] => 2020-08-05 [timestamp] => 1596585600 [dateTime] => DateTime Object ( [date] => 2020-08-05 00:00:00.000000 [timezone_type] => 3 [timezone] => UTC ) ) Array ( [time] => 2020-08-05T00:00:00Z [timestamp] => 1596585600 [dateTime] => DateTime Object ( [date] => 2020-08-05 00:00:00.000000 [timezone_type] => 2 [timezone] => Z ) ) equal timestamps: true Quote Link to comment https://forums.phpfreaks.com/topic/311363-what-are-the-differences-and-implications-of-utc-time-and-zulu-time/ Share on other sites More sharing options...
gw1500se Posted August 21, 2020 Share Posted August 21, 2020 Search engines are your friend. GMT, UTC and ZULU Time Explained Quote Link to comment https://forums.phpfreaks.com/topic/311363-what-are-the-differences-and-implications-of-utc-time-and-zulu-time/#findComment-1580835 Share on other sites More sharing options...
NotionCommotion Posted August 21, 2020 Author Share Posted August 21, 2020 1 hour ago, gw1500se said: Search engines are your friend. GMT, UTC and ZULU Time Explained Thanks gw1500se, Before posting this question, I did look at several sources such as https://www.timeanddate.com/time/zones/z which described it as military time. Both your and my reference state that it is the same as UTC, but as seen by the output of my initial script, they have different timezone types and I didn't know what implications that might have. Quote Link to comment https://forums.phpfreaks.com/topic/311363-what-are-the-differences-and-implications-of-utc-time-and-zulu-time/#findComment-1580838 Share on other sites More sharing options...
requinix Posted August 21, 2020 Share Posted August 21, 2020 Don't worry about the timezone_type. It's a "military timezone" because they use single letters to identify UTC offsets. Supposedly. https://en.wikipedia.org/wiki/List_of_military_time_zones Z === UTC. But it's such a convenient symbol that just about everybody else uses it too. Quote Link to comment https://forums.phpfreaks.com/topic/311363-what-are-the-differences-and-implications-of-utc-time-and-zulu-time/#findComment-1580863 Share on other sites More sharing options...
NotionCommotion Posted August 22, 2020 Author Share Posted August 22, 2020 19 hours ago, requinix said: Don't worry about the timezone_type. It's a "military timezone" because they use single letters to identify UTC offsets. Supposedly. https://en.wikipedia.org/wiki/List_of_military_time_zones Z === UTC. But it's such a convenient symbol that just about everybody else uses it too. Thanks, Will lose no more sleep over it! Quote Link to comment https://forums.phpfreaks.com/topic/311363-what-are-the-differences-and-implications-of-utc-time-and-zulu-time/#findComment-1580887 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.