【发布时间】:2019-08-19 08:16:58
【问题描述】:
我想使用带有时区数据类型的 Postgres 时间戳记。
我的迁移有这一行:
$table->dateTimeTz('local_timestamp');
我尝试这样播种:
$note->local_timestamp = Carbon::now();
我在播种时也尝试过这样格式化:
$note->local_timestamp = Carbon::now()->format('Y-m-d H:i:sO');
我这样检索我的种子数据:
$data = Note::where('owner', $owner)->get();
我在 Carbon 错误中收到 InvalidArgumentException“数据丢失”,显示如下:
at Carbon::rawCreateFromFormat('Y-m-d H:i:sO', '2019-03-28 14:02:42', null)
我已经尝试在我的模型中包含这条线,因为我已经看到它建议作为其他类似问题的答案:
protected $dateFormat = 'Y-m-d H:i:sO';
【问题讨论】:
标签: laravel postgresql-9.1 php-carbon