You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Its a default value for SQL databases, but When you try to set a value
-0001 you cant insert it
El vie., 10 dic. 2021 8:22, Damian Wadley ***@***.***>
escribió:
0000-00-00 is not a valid date, but PHP will do its best to transform it into a valid date. The result is -0001-11-30.
MySQL only supports dates from 1000-01-01 to 9999-12-31, so it will not support year -0001 (and also not support year 0001).
If you want to use DateTime then you need to make sure the date is not 0000-00-00 first. You'll need to think about what your code should do if it receives that value: what does it mean, and can you use it as a real date, and how should you display it to a user?
Or instead, I suggest you should use NULL and not the default date. Then your PHP values will always be either nulls or valid DateTimes.
From manual page: https://php.net/class.datetime
when we create a new variable with value '0000-00-00' the variable get a wrong value
DateTime Object
(
[date] => -0001-11-30 00:00:00.000000
[timezone_type] => 3
[timezone] => Europe/Berlin
)
The text was updated successfully, but these errors were encountered: