I have a laravel app and i'm trying to save the users checkins and checkouts to my database
i have a model Checkins
and i record it like created_at and updated_at
on my localhost it save with the right time for my timezome ( Egypt ), i tried to changed app.php
file to the following
|--------------------------------------------------------------------------
| 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.
|
| This is a bad thing really i think there is a problem within the server, the datetime
*/
'timezone' => 'EET',
it's working just fine on my localhost and save with the current right time, for the production it's save with UTC timezone
Also when i write in the production terminal the command date date
, i get the following
Tue Mar 31 12:46:38 EET 2015
and i checked mysql for the timezone and i found it's getting the time from the system time
SELECT @@global.time_zone, @@session.time_zone;
SYSTEM
What's wrong here ?
I created a php page with date('H:i:s');
and it's print the right time
To set the timezone for your Laravel app, change the 'timezone'
in your config/app.php
|--------------------------------------------------------------------------
| 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.
|
| This is a bad thing really i think there is a problem within the server, the datetime
*/
'timezone' => 'America/Los_Angeles',
You can find the timezone you need here.
You have to change yout time zone in config/app.php
Also as is said here you must run following commands for your time zone changes to be saved:
php artisan cache:clear
php artisan view:clear
php artisan config:cache
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With