Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

278
Views
incorrect time returned in laravel

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?

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

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.

Timezone list reference

about 4 years ago · Santiago Trujillo Report

0

You can set your timezone in the Laravel config files. The default value is UTC.

Make sure this is set to your correct timezone.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!