Understanding gmtime return value

I can’t understand why gmdate() and date() reutrn are the same if my server is not configured for Greenwich Mean Time.

Why is this?

 echo time(); // 1311011114 echo date("U"); // 1311011114 echo gmdate("U"); // 1311011114 echo date("jmy H:m:s"); // 18-07-11 12:07:14 echo date("e"); // America/Chicago echo date("O"); // -0500 echo date("T"); // CDT 

UPDATE
How do I get the current GMT time? calculation with date ("O")? Is there another way?

+8
timezone php
source share
3 answers

Because time never changes - it is always seconds from the era (GMT).

Time is always the same. It’s just that your time zone is different, and that’s how the delivery date is different.

You can change the time zone to see the time in different zones.

See here for all Date / Time functions.

+5
source share

So, a long time ago, people needed a way to determine the time in several computing systems that were in shape. Decisive for this were the Council on Settlement Syntactic Advice of the Wise Elders (CSCWE for short) of pre-industrial age. The secret ballot decided that an arbitrary starting point would mark a more advanced computing age in 1970. Thus, from this moment began an endless procession of seconds through decades, a new time for calculating a revolution with a steady strike of seconds.

From this arbitrarily determined beginning, all computational time can be determined by performing mathematical magic against this increasing number of seconds, and then factoring time zones.

+2
source share

He already answered, but if you want to get the local time and UTC,

 date_default_timezone_set('America/Chicago'); $format = 'Ymd H:i:s'; $time1 = time(); $time2 = strtotime(gmdate($format)); print date($format, $time1); print date($format, $time2); // 2014-07-24 17:31:23 // 2014-07-24 22:31:23 
0
source share