How to set local timezone in laravel?

by , in category: PHP Frameworks , 5 months ago

How to set local timezone in laravel?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer


by jasen , 5 months ago 

To set the local timezone in Laravel, you can follow these steps:

  1. Open the config/app.php file in your Laravel project.
  2. Find the timezone configuration option. By default, it is set to 'UTC'. Change this value to the timezone you want to set. For example, if you want to set the timezone to 'Asia/Kolkata', you would change the 'timezone' value to 'Asia/Kolkata'. 'timezone' => 'Asia/Kolkata',
  3. Save the config/app.php file. Note: If you are using Laravel 5.2 or above, you can also set the timezone by using the config/services.php file. Add the following array entry to the 'laravel-google-calendar' configuration array: 'timezone' => 'Asia/Kolkata',
  4. Finally, make sure to clear the config cache for the changes to take effect. You can do this by running the following command: php artisan config:cache

That's it! Your local timezone should now be set in Laravel.