Ad

Laravel Timestamps Are Behind

- 1 answer

When I register a user in my laravel application, the timestamps are 1 hour behind? So in The Netherlands it's 16.50 and my timestamps save 15.50.

How could I solve this problem?

Ad

Answer

Make sure in your config/app.php the following line contains the correct timezone.

'timezone' => 'Europe/London',

If you change this settings, unfortunately old entries won’t be changed automatically, but new ones will be saved with created_at, updated_at and similar fields in your specified timezone.

For international projects it could be a good strategy to have all timestamps in UTC format and then show the date by user timezone with Carbon. It gives more flexibility now and in the future.

Ad
source: stackoverflow.com
Ad