Introduction: This is a detailed page for MySQL computing time. It introduces related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 335090 'rolling = 'no'>
MySQL has two functions for date addition. There is no difference between adddate and date_add.
Select count (*) from table where time & gt; = adddate ('2017-03-12 ', interval 1 day)
Select count (*) from table where time & gt; = date_add ('2017-03-12 ', interval 1 day)
If it is reduced, you can:
Select count (*) from table where time & gt; = adddate ('2017-03-12 ', interval-1 day)
Select count (*) from table where time & gt; = date_add ('2017-03-12 ', interval-1 day)
Date has datediff (T1, T2), and time has timediff (T1, T2 );
Both are t1-t2;
Select datediff ('2017-08-08 ', '2017-08-01'); -- 7
Select datediff ('2017-08-01 ', '2017-08-08'); ---7
Select timediff ('2017-08-08 08:08:08 ', '2017-08-08 00:00:00'); -- 08:08:08
Select timediff ('08: 08: 08', '00: 00: 00'); -- 08:08:08
Note: The two parameter types of the timediff (time1, time2) function must be the same.
(Sometimes, you need to add two times. At this time, MySQL does not provide a method similar to timediff. I have tried it. You can do this:
Select timediff ('22: 10: 20', '-23:52:11 ');
The returned result is: 46: 02: 31.
More articles on "MySQL computing time"
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/335090.html pageno: 10.