Home >Backend Development >PHP Tutorial >Solution to incorrect date output by php date() function_PHP Tutorial
Friends who are using PHP for the first time may find that after we configure the PHP environment and use the PHP date function to output the date, we will find that the date is related to the correct date by 8 hours.
Example
The code is as follows
| Copy code
| ||||||||||||||||
echo date('Y-m-d H:i:s');
?〉
Output current time: 2008-10-12 02:32:17 Weird, the actual time is: 2008-10-12 10:32:17Could it be that PHP’s date() time is incorrect and is 8 hours short? Look at the "Example 1. date() example" in the PHP manual. There is an extra time zone setting in the first line //Set the default time zone to use. Available since PHP 5.1
Statement: The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn Previous article:java save information php read and write memcache garbled problem_PHP tutorialNext article:java save information php read and write memcache garbled problem_PHP tutorial Related articlesSee more |