I have to live with an INT in our date/time records in MySQL, so I'm trying to figure out whether it's better to use 0 or NULL as the default for those fields. We're migrating, and data is coming in as 0000-00-00 00:00:00, a Unix timestamp, 0, NULL, false, etc, so I'm converting everything through the PHP strtotime() and date() functions, but getting weird results on insert.
Ultimately I can end up with something usable in PHP, but I'm not sure whether after the fact which is better to use as the default in MySQL.
0 is a value. NULL is a lack of a value.
Use NULL.
If you want to express the absence of a value, you should use Null. 0 in epoch time is equal to midnight on January 1, 1970. Therefore, based on the description of your situation I would suggest using Null.
http://www.epochconverter.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With