Home > PHP Framework > Laravel > How to set China time zone in laravel

How to set China time zone in laravel

青灯夜游
Release: 2021-09-17 15:18:30
Original
5578 people have browsed it

How to set the Chinese time zone: 1. Open the "app.php" file in the "app/config/" path under the laravel framework directory and find "'timezone' => 'UTC'"; 2. Change Just modify it to "'timezone' => 'Asia/Shanghai'".

How to set China time zone in laravel

The operating environment of this tutorial: Windows 7 system, Laravel 6 version, Dell G3 computer.

Recently I wrote a small program using laravel as the backend. I found that created_at was 8 hours less than Beijing time. .

I checked the settings of PHP and found that there was no problem. Then I checked laravel and found that the time zone setting was wrong. Just modify it.

How to set the Chinese time zone in laravel:

1. Open the app/config/app.php file in the laravel framework directory

and you will find the following line:

'timezone' => 'UTC'
Copy after login

so, change it to

'timezone' => 'Asia/Shanghai',
Copy after login

Save the changes and it will be ok, the time will be normal.

Related recommendations: The latest five Laravel video tutorials

The above is the detailed content of How to set China time zone in laravel. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
Statement of this Website
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
Latest Issues
Composer cannot install laravel
From 1970-01-01 08:00:00
0
0
0
Laravel Space/laravel-backup cannot be installed
From 1970-01-01 08:00:00
0
0
0
Laravel 5.1 Login laravel comes with it No more
From 1970-01-01 08:00:00
0
0
0
Why thinkphp has better performance than laravel?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template