In
config/app.php
'timezone' => 'UTC',
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I've been trying to research for a solution getting user specific timezones working properly with Laravel and MySQL, but all I can find are Eloquent mutations or in SPA front end mutations using Momentjs.... This however is not a good solution because you end up converting timezones all over the app and sooner or later something slips by unconverted causing issues. In addition if user supplies a time it needs to be converted back to UTC... In my previous apps this was accomplished by setting:
So basically MySQL runs and stores everything in UTC. Webserver's timezone is also set to UTC. Now when the application connects to MySQL it sets connection setting based on the user's timezone. When done this way every date/time that comes out of the database is automatically converted to/from the user's timezone and application logic doesn't get cluttered with timezone conversions.
The big guestion is: How does one set the MySQL timezone in Laravel so that it gets applied to all database queries whether they use query builder or Eloquent?
Thanks for any pointers you may have!
Please or to participate in this conversation.