A question about the phpdate () function
Today, when looking at the PHP manual, we found that the date function can be directly passed the parameter z,php the manual explains: date (' Z ') is the number of seconds of the offset of the time difference. The time zone offset in the west of UTC is always negative, and the time zone offset to the east of UTC is always positive. But I execute the following code:
PHP Code
According to reason is the difference of 8 hours, date (' Z ')/3600 should output 8 why the output is 0?
------Solution--------------------
Output is 8
If your time zone doesn't change, then it should be 0.
echo Date (' Z ')/3600;
echo gmdate (' Z ')/3600;
If the output is the same, your time is GMT
------Solution--------------------
Because you did not set the local time zone, if you set the php.ini in the Date.timezone or with Date_default_timezone_set ()
Set the local time zone, the result is 8.
------Solution--------------------
You are using the default green time. So echo date (' Z ') offset returns 0