Home >Database >Mysql Tutorial >How to calculate the number of complete 24-hour days between two specified dates in MySQL?
In the DATEDIFF() function, only the date part of the value is used for calculation, so we can use the TIMESTAMPDIFF() function to calculate the number of complete 24-hour days between two specified dates.
For example, if we want to find the complete 24-hour days between '2017-05-27 11:59:00' and 2017-05-23 12:00:00', then the following is the MySQL query -
mysql> Select TIMESTAMPDIFF(DAY, '2017-05-23 12:00:00' , '2017-05-27 11:59:00'); +---------------------------------------------------------------------------+ | TIMESTAMPDIFF(DAY, '2017-05-23 12:00:00' , '2017-05-27 11:59:00') | +---------------------------------------------------------------------------+ | 3 | +---------------------------------------------------------------------------+ 1 row in set (0.00 sec)
The above is the detailed content of How to calculate the number of complete 24-hour days between two specified dates in MySQL?. For more information, please follow other related articles on the PHP Chinese website!