skip to Main Content

I have made a laravel application which save data in db as UTC. My client is in South Africa and he wants the records to be displayed in South Africa timezone. Any body guide me related to this.
Thanks

I tried to convert created-at to specific timezone using Carbon while displaying record any where in system.

2

Answers


  1. Go to config/app.php and then search and edit the value of timezone like this.

     'timezone' => 'Africa/Johannesburg',
    

    And then you need to clear the config settings stored in cache.

    php artisan cache:clear

    php artisan config:cache

    Then start the project again to see the chages.Try this.It will work.

    Login or Signup to reply.
  2. if you are not getting proper timezone the first you need to set that time-zone into your .env file like that

    TIME_ZONE="country-name/area-name"
    example
    TIME_ZONE="Asia/Kolkata"

    After that you need to set that configuration into you config/app.php file like

    ‘timezone’ => env(‘TIME_ZONE’, ‘country-name/area-name’),

    example

    ‘timezone’ => env(‘TIME_ZONE’, ‘Asia/Kolkata’),

    so use like that so it will giving actual time.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search