Laravel changing timezone not reflecting the correct time

前端 未结 4 1074
一生所求
一生所求 2020-12-06 07:24

I am changing the timezone into Asia/Singapore at config/app.php, but when I try to do a date(\"Y-m-d H:i:s\"); the result is still in

4条回答
  •  情歌与酒
    2020-12-06 08:17

    The date() function php won't load configuration from Laravel config/app.php. To change timezone you should change it via php.ini on date.timezone parameter. Don't forget to restart your apache after change it.

    Or if you wan't more flexibility, there are Carbon package. It has many usefull functions to deal with datetime operation.

提交回复
热议问题