Original link: https://www.mqllin.cn/archives/190.html
strtotime(‘2020-01-30 12:00’)); //specified date and time stamp
time(); //current timestamp
curdate() //Indicates the date of the day
“`
Count the log sql statements of the previous day:
“`
select * from bean where date(log_time) = date_sub(curdate(), interval 1 day);
“`
Requirement: Statistics start from yesterday and count the logs of the previous 7 days including yesterday
“`
select * from user where date(log_time) >= date_sub(curdate(), interval 7 days) and date(log_time)
This article is transferred from: https://www.mqllin.cn/archives/190.html
This site is only for collection, and the copyright belongs to the original author.