LoginSignup
0
0

More than 1 year has passed since last update.

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '1988' for column 'created_at' at row 1

Posted at

SQLが悪そうなので、

試したこと

SQLの 「created_at 」のタイプを「date」 →「timestamp」へ変更

「date」 とは
”1000-01-01 00:00:00″から”9999-12-31 23:59:59″
・年、月、日、時、分、秒を持ちます。ミリ秒がありません。
・文字列をDate型にするには、TO_DATE関数を使用します。
・Date型を文字列にするには、TO_CHAR関数を使用します。

「timestamp」とは
・”1970-01-01 00:00:01″UTC から”2038-01-19 03:14:07″UTC
・年、月、日、時、分、秒、秒の小数部を持ちます。
・文字列をTIMESTAMP型にするには、TO_TIMESTAMP関数を使用します。
・TIMESTAMP型を文字列にするには、TO_CHAR関数を使用します。
・TIMESTAMP(6)の6は、小数部の桁を意味します。

画面上
mysqlのタイプを「date」にすると「 2000-04-18 」となります

mysqlのタイプを「timestamp」にすると「 1988-04-18 00:00:00 」となります

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0