将这些值插入数据库表时出现此错误:
SQLSTATE[22007]:无效的日期时间格式:1292 不正确的日期时间值: 第 1 行的“registration_from”列的“24/06/2017” (SQL:插入`campus_registrations`(`campus_major_class_id`, `registration_from`, `registration_to`, `testing`, `announcement`, `enrollment_from`, `enrollment_to`, `updated_at`, `created_at`) 值 (3, 2017 年 6 月 24 日、2017 年 6 月 27 日、2017 年 7 月 13 日、2017 年 1 月 8 日、2017 年 5 月 9 日、2018 年 1 月 31 日、 2017-06-07 09:39:31, 2017-06-07 09:39:31))
我必须先启动日期时间还是什么?
原文由 goateee25 发布,翻译遵循 CC BY-SA 4.0 许可协议
错误在这里:
date
mysql 中列的默认格式是Y-m-d
并且datetime
是Y-m-d H:i:s
。因此,将您的日期更改为这种格式,然后重试。