0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Laravelのタイムゾーンを日本時間に変更する

Posted at

”UTC”から”Asia/Tokyo”に変更

LaravelのタイムゾーンはデフォルトでUTCになっているため、ログに残る時間やcreated_atが日本時間より9時間遅れた時間が記録されてしまう。
config/app.phpファイルの記述を変更すればよい

変更前

config/app.php
'timezone' => 'UTC',
$ php artisan tinker
>>> echo Carbon\Carbon::now();
2022-05-03 01:40:21⏎

変更前

config/app.php
'timezone' => 'Asia/Tokyo',

キャッシュクリア

$ php artisan config:clear

確認

$ php artisan tinker
>>> echo Carbon\Carbon::now();
2022-05-03 10:40:49⏎
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?