Change Timezone in Lumen or Laravel 5

前端 未结 15 1344
逝去的感伤
逝去的感伤 2020-11-29 02:56

I am using Lumen framework. How can I change Timezone to Europe/Paris CEST?

I added a varaible in my .env file:

APP_TIMEZONE=Europe/Pari         


        
相关标签:
15条回答
  • 2020-11-29 03:52

    Just changing APP_TIMEZONE=Asia/Colombo in .env and run php artisan lumen-config:cache worked for me in lumen 5.7

    0 讨论(0)
  • 2020-11-29 03:56

    By default time zone of laravel project is **UTC*

    • you can find time zone setting in App.php of config folder

    'timezone' => 'UTC',

    now change according to your time zone for me it's Asia/Calcutta

    so for me setting will be 'timezone' => 'Asia/Calcutta',

    • After changing your time zone setting run command php artisan config:cache

    *for time zone list visit this url https://www.w3schools.com/php/php_ref_timezones.asp

    0 讨论(0)
  • 2020-11-29 04:01

    You just have to edit de app.php file in config directory Just find next lines

    /*
    |--------------------------------------------------------------------------
    | 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.
    |
    */
    
    'timezone' => 'UTC',
    

    And.. chage it for:

    'timezone' => 'Europe/Paris',
    
    0 讨论(0)
提交回复
热议问题