Reputation: 12909
SO, i want to store some dates in my database, but whenever i try to insert it i get:
Invalid datetime format: 1292 Incorrect datetime value: '2050-12-12 00:00:00' for column 'object_end'
However if i use for example 2021
as year, it works fine. Checking MySQL documentation seems like it supports dates until year 9999
, so why am i getting this error? (if you need some code, feel free to ask, i'll edit the question with that code)
Upvotes: 0
Views: 98
Reputation: 12188
your 'object_end' field is absolutely of type 'TIMESTAMP'
and according to mysql documentation:
The TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.
to sole the problem, just change the column type to DateTime
please note that the fields 'created_at','updated_at' are generated as TIMESTAMP note DateTime more details in:
https://dev.mysql.com/doc/refman/8.0/en/datetime.html
Upvotes: 1