How to set Timezone in Laravel
Thursday, 19 August 2021
An easy way to set a timezone for a user in your application and then show date/times to them in their local timezone.
You can set your app time zone by configuring app.php file in config folder.
- Open the file app.php located in config directory in your project. Check for Application Timezone where default time zone will be set as,
Here you can add your time zone as below,
This is the time zone for paris
'timezone' => 'Europe/Paris',
This is the time zone for India
'timezone' => 'Asia/Kolkata',
After changing app.php, make sure you run below command,
php artisan config:clear
How to change time zone in .env file
Here you can add your timezone like.
'timezone' => env('APP_TIMEZONE', 'UTC'),
APP_TIMEZONE='Europe/Paris'
- Published in PHP Programming
No Comments