phpwcms icon indicating copy to clipboard operation
phpwcms copied to clipboard

Mysql date datetime and stamptime

Open kudomk opened this issue 6 years ago • 1 comments

Creating the mysql tables, the default values have changed: date The supported range is '1000-01-01' to '9999-12-31', not '0000-00-00' datetime The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. not '00..00' TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.

so please, changed, not only in CREATE TABLE... in INSERTs too. Thanks

kudomk avatar Aug 24 '19 21:08 kudomk

I cannot recommend STRICT or NO_ZERO_DATE mode. There are too many possible problems. I am not sure if I will change this soon. https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_zero_date

Check also this config value https://github.com/slackero/phpwcms/blob/master/include/config/dist.conf.inc.php#L25

slackero avatar Aug 30 '19 18:08 slackero

Commit a7ec43a2cb2e8e43459e7fcc81b61a2a8de80d03 adds the functionality to auto-convert DATE, DATETIME and TIMSTAMP fields. The former defaults 0000-00-00 00:00:00 and 0000-00-00 are converted to NULL. Queries will check against IS NULL.

slackero avatar Sep 12 '23 21:09 slackero