This is a strange problem
I am using date functions to get time too but it returns wrong time
return date('Y-m-d H:i:s');
This returns 2017-4-21 09:41:44 but the current time is 14:41:44
There is something wrong with hours.
I tried NOW() in MySQL and it gave me correct timing but laravel PHP did not. Can someone help?
In laravel project go to project/config there is a file app.php, in this file search for:
'timezone' => '';
pass your timezone value in it like:
'timezone' => 'Asia/Kolkata', // I am using this for India
And try again, now you will get the correct time as per your timezone.
Note: After passing the timezone value run the command php artisan config:cache to clear the cache so that you get the updated data.
You can set your timezone in the Laravel config files. The default value is UTC.
Make sure this is set to your correct timezone.