Jump to content

What are the differences and implications of UTC time and Zulu time?


NotionCommotion

Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.