How to change your Laravel’s timezone like a boss 😎
Howdy,
It’s been a while since I last logged a post, glad to be back and continue to provide value.
As a developer, whether you are working on a new project or an existing Laravel application, it can sometimes be important for the application’s timezone to match the current location’s timezone.
Please notice that laravel has a default timezone which is set to UTC. Hence you might want to change it to your local timezone, if yes please follow the below options and procedures.
First Option
open the config directory from your laravel application.
Edit the app.php file next and the timezone value from UTC to the desired timezone from available timezones.
‘timezone’ => ‘Africa/Nairobi’,
Second Option
Make a modification in the .env file to specify the timezone as follows:
APP_TIMEZONE=’Africa/Nairobi’
Then, add the following in the app.php file:
‘timezone’ => env(‘APP_TIMEZONE’, ‘UTC’),
This involves making some changes to the app.php file.
Once those changes have been made, it is important to run the following command to clear the config settings stored in the cache.
php artisan config:clear
Congrats you have changed your default timezone :)
Before you go… I would like to introduce to you storewid.com, an eCommerce platform that can help you build, manage and grow your online store with ease.
Visit storewid.com and try it out for free.
Thanks for reading the article! If you enjoyed it, please don’t forget to show your appreciation by clicking 👏 below!
Any questions or comments hit me up on
Mail: epmnzava@gmail.com
Twitter: https://twitter.com/epmnzava
Github: https://bit.ly/3L4IXaC
LinkedIn: https://bit.ly/3w5Oklq