How to update the timezone for the timestamps (created_at and updated_at) managed by Laravel Eloquent?

前端 未结 4 1879
栀梦
栀梦 2020-12-28 21:32

I have a server in GMT but I want to update those fields ( *created_at* and *updated_at* ) to save timestamps in PST.

I\'ve already did some tests trying to accompli

4条回答
  •  天命终不由人
    2020-12-28 22:05

    it's simple,just modify function boot() in AppServiceProvider.php

    public function boot()
    {
        //set local timezone
        date_default_timezone_set('Asia/Shanghai');
    }
    

提交回复
热议问题