I am getting the following error when trying to save the model to the database.
SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2021-03-14 02:48:04' for column `cref_radmin`.`mrelevance_realestate_listings`.`photos_updated_at` at row
1
Which is very strange because when I test this exact same thing locally it works without any problems and the even more bizarre thing is the datetime value looks correctly formatted to me and I don't understand why MySQL/MariaDB is complaining about it being incorrect. The photos_updated_at column is just a regular timestamp field, nothing special.
Does anyone know what might be causing this issue?
Yes, both have the same migrations applied and I've even tried by importing mysqldump from production into local database. Both are using the same database and database version. The only difference is the production server is running WHM/CPanel, but I have the same my.cnf config file applied to my local database server (which is a docker container).
It seems when I convert it to datetime it doesn't throw the error anymore, however I then get the same previous error on the created_at column which is a timestamp field. So it seems like something happened with the database and it doesn't like the timestamp fields anymore?
I'm currently running MariaDB 10.3 on WHM/Cpanel (I have full root access on the dedicated server)
And the really weird thing is I am able to create a new model just fine, so it seems like something weird is happening for this one specific record/data even though it looks fine and normal to me.
Doing some further testing directly in PhpMyAdmin, it looks like even if I directly type in the date and time as it appears in the array I posted in the comment above it still throws an exception saying invalid TIMESTAMP value in column. So, it isn't actually an issue with Laravel and is an issue with the database for some reason.
It seems like it has something to do with the hour value in the timestamp where if I set it to 02 is throws the exception, but if I set it to any other hour it saves correctly. But, I'm still confused as to why it would work on my local database but not on the actual staging/production server/database in CPanel.