🙏 Please consider SUBSCRIBING !!! 🧧 Patreon Donations: / theflask
Click "SHOW MORE" below to see the cool guides !!! 😎
MySql Date Data Type
Reference:
https://dev.mysql.com/doc/refman/5.7/...
https://gist.github.com/joemalski/b75...
DATE - used for values with a date part but no time part
format, 'YYYY-MM-DD'
'1000-01-01' to '9999-12-31'
YYYY part accepts 2-digit year format but don't use it!
Dates containing 2-digit year values are ambiguous
because the century is unknown.
Year values in the range 00-69 become 2000-2069.
Year values in the range 70-99 become 1970-1999.
Again, apply the "KISS" principle just use 4-digit year format.
CREATE TABLE test (
col_date DATE
);
DESC test;
-- min and max values '1000-01-01' to '9999-12-31'
INSERT INTO test (col_date) VALUES ('1000-01-01');
INSERT INTO test (col_date) VALUES ('9999-12-31');
-- 2-digit year vs. 4-digit year
INSERT INTO test (col_date) VALUES ('79-08-22');
INSERT INTO test (col_date) VALUES ('1979-08-22');
SELECT * FROM test;
+------------------+
| col_date |
+------------------+
| 1979-08-22 |
| 1979-08-22 |
+------------------+
🙏 Please consider SUBSCRIBING !!! 🧧 Patreon Donations: / theflask
DISCLAIMER:
All product and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
Use of MySQL Conditional Use Logos:
https://bit.ly/3iwhu4I