Laravel changing timezone not reflecting the correct time
Just do this:
'timezone' => 'Asia/Singapore'
in config/app.php
file and run this 3 command:
php artisan cache:clear
php artisan view:clear
and
php artisan config:cache
Hope this helps you!!
Change timezone in laravel
After update app.php run below command and check
php artisan config:cache
php artisan cache:clear
You can create below type of route for clear cache in laravel
Route::get('/clear-cache', function() {
$configCache = Artisan::call('config:cache');
$clearCache = Artisan::call('cache:clear');
// return what you want
});
How to change timezone using date() and strtotime() in Laravel
You can set your app time zone by configuring app.php
file in config
folder .
To change time zone , modify the value of timezone in app.php file.
This is written in this section
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
For me i am using Asia/Kuala_Lumpur as my application time zone.
Here is the appropriate syntax :
'timezone' => 'Asia/Kuala_Lumpur'
list of timezones for PHP
NOTE : run
php artisan config:clear
to effect this changes
Laravel change timezone
Try to clear the config cache:
php artisan optimize:clear
Laravel lumen is not saving right time zone
Try adding 'timezone' => env('APP_TIMEZONE', "UTC")
to your config/app.php
and running php artisan cache:clear
after that.
Also try adding DB_TIMEZONE=+05:00
to your .env
file (adjusted to your UTC offset of course)
Related Topics
How to Use MySQL Found_Rows() in PHP
How to Solve "Non-Static Method Xxx:Xxx() Should Not Be Called Statically in PHP 5.4
How to Add a View Helper Directory (Zend Framework)
Why Composer Can Not Find My Brand New Package on Packagist.Org
Best Method for Converting a PHP Array to JavaScript
Is There a Function Similar to Settimeout() (Javascript) for PHP
How to Use MySQLi_Fetch_Object with a Prepared Statement
PHP Email - How to Avoid Mail Ending Up in Spam Box
Phpmailer Not Sending and Not Giving Error
Escaping Curl @ Symbol with PHP
Why Can't PHP on Windows See Extension PHP_Intl.Dll Even Though It Exists
Pass Form Data to Another Page with PHP
PHP Session Id Changing on Every Request