webman timestamp 时间乱码

workerman_dylan

截图

数据库:DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
created_at timestamp NULL DEFAULT NULL,
updated_at timestamp NULL DEFAULT NULL,
deleted_at timestamp NULL DEFAULT NULL,

994 1 0
1个回答

yzh52521

illuminate/database 是吧?
自己去laravel 看文档

  • workerman_dylan 2022-06-21

    laravel 【use DefaultDatetimeFormat;】webman不知道该如何处理

  • yzh52521 2022-06-21
    namespace app\common\traits;
    
    use Carbon\CarbonInterface;
    use DateTimeInterface;
    
    trait DateFormat
    {
        protected function serializeDate(DateTimeInterface $date): string
        {
            return $date->format(CarbonInterface::DEFAULT_TO_STRING_FORMAT);
          //  return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
        }
    }

    model里
    use DateFormat;

年代过于久远,无法发表回答
🔝