[英]Invalid datetime format: 1366 Incorrect integer value:
This is my controller and columns type is int(11) in database 这是我的控制器,数据库中的列类型为int(11)
$req['date_time'] = ($req->date_time) ? Carbon::createFromFormat('d/m/Y', $req->date_time)->timestamp : '0';
$req['publish_date'] = ($req->publish_date) ? Carbon::createFromFormat('d/m/Y', $req->publish_date)->timestamp : '0';
$req['expiration_date'] = ($req->expiration_date) ? Carbon::createFromFormat('d/m/Y', $req->expiration_date)->timestamp : '0';
CmsArticle::create($req->all());
Are you sure all the columns are integers? 您确定所有列都是整数吗? SQL Server returns that error when an invalid value is used where a
datetime
type is needed. 当在需要
datetime
类型的地方使用了无效值时,SQL Server将返回该错误。
Perhaps the value 0
shouldn't be used, and instead insert a null or a special date far in the past? 也许不应该使用值
0
,而是在过去很久之前插入一个null或特殊日期?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.