sgt*_*sco 2 php timestamp laravel
我的数据库中有一个自定义时间戳字段, delivery_date
$table->timestamp('delivery_date')->nullable();
Run Code Online (Sandbox Code Playgroud)
每当我尝试使用此字段时,它都会将其作为字符串引入...
"2018-12-17 00:00:00"
Run Code Online (Sandbox Code Playgroud)
但是created_at,例如,如果我使用带有时间戳的相同代码,则会将其作为时间戳引入。
date: 2018-12-09 00:00:00.0 America/New_York (-05:00)
我曾试图改变迁移外地datetime,并date具有相同的结果。
我也尝试通过...转换结果
strtotime($order->delivery_date)
Run Code Online (Sandbox Code Playgroud)
但出于某种原因,它将其转换为整数。
小智 9
为了将 delivery_date 设为 created_at,您必须将 delivery_date 添加到您的模型中 protected $dates = ['delivery_date'];
| 归档时间: |
|
| 查看次数: |
1120 次 |
| 最近记录: |