Change Timezone in Lumen or Laravel 5

前端 未结 15 1403
逝去的感伤
逝去的感伤 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:47

    Please try this - Create a directory 'config' in your lumen setup, and then create app.php file inside this 'config' dir. it will look like this -

     'America/Los_Angeles'];
    

    Then you can access its value anywhere like this -

    $value = config('app.timezone');
    

    If it doesn't work, you can add this lines in routes.php

    date_default_timezone_set('America/Los_Angeles');
    

    This worked for me!

提交回复
热议问题