🙏 Please consider SUBSCRIBING !!! 🧧 Patreon Donations: / theflask
Click "SHOW MORE" below to see the cool guides !!! 😎
MySql TIMESTAMP Data Type
References:
https://dev.mysql.com/doc/refman/5.7/...
https://gist.github.com/joemalski/b75...
TIMESTAMP - literary used as time stamp
it is the combination of all Date Data Types,
TIME, YEAR, DATE and DATETIME.
'1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC
automatic default: CURRENT_TIMESTAMP, together with another
column for it to work, sample time stamp: '2020-07-16 15:39:01'
format:'YYYY-MM-DD hh:mm:ss.ffffff'
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.
TIMESTAMP(fsp) WHERE: max fsp is 6
Note: You need to explicitly specify the "fsp" so that
the data will be saved to the database.
-- Demo CURRENT_TIMESTAMP
CREATE TABLE test (
col_id INT,
col_timestamp TIMESTAMP
);
DESC test;
INSERT INTO test (col_id) VALUES (1);
SELECT * FROM test;
-- explicitly INSERT a record
INSERT INTO test (col_timestamp) VALUES ('2020-07-19 18:09:33');
INSERT INTO test (col_timestamp) VALUES ('2020-07-19');
SELECT * FROM test;
-- YEAR example
INSERT INTO test (col_timestamp) VALUES ('70-07-19 18:09:33');
INSERT INTO test (col_timestamp) VALUES ('69-07-19 18:09:33');
SELECT * FROM test;
-- fractional seconds demo
DROP TABLE test;
CREATE TABLE test (
col_timestamp TIMESTAMP(6)
);
INSERT INTO test (col_timestamp) VALUES ('2020-07-19 18:09:33.1234567');
SELECT * FROM test;
🙏 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