Mysql (5) operation Time: bitsCN.com
Mysql those things (5) operation time I. time command: SELECT CURDATE (); function: return today's date value in 'yyyy-MM-DD 'format. Command: select curtime (); function: return time in 'hh: MM: SS' format. Command: select now (); function: return time in 'yyyy-MM-DD HH: MM: SS' format. 2. the TIMESTAMP column type can automatically mark the time when the insert update operation is performed. Example: create table student (id INT, english TINYINT, math TINYINT, chinese TINYINT, time TIMESTAMP); INSERT data: insert into student (id, english, math, chinese) VALUES (,); query data: SELECT * FROM student; result: student id | english | math | chinese | time | Minute 1 | 12 | 23 | 45 | 10:34:09 ------------------------------------------------------------------------- The time column automatically adds the data INSERT time. UPDATE also affects the time value of the time column of the data. The storage requirement of TIMESTAMP is 4 bytes; that of DATETIME is 8 bytes. 3. compare the time SELECT TO_DAYS (date); give a date, and return the number of days from 0 years (until date ). Example: SELECT TO_DAYS (NOW ()-TO_DAYS ('1970-10-19 '): return 1 day. SELECT TO_DAYS (NOW (); returns the 735161 day. That is, the number of days from now until 0 years. BitsCN.com
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.