
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I calculate full 24hour days between two specified dates in MySQL?
In DATEDIFF() function only the date parts of the values are used in calculation hence we can use TIMESTAMPDIFF() function to calculate full 24 hour days between two specified dates.
For example, if we want to find full 24hour days between ‘2017-05-27 11:59:00’ and 2017-05-23 12:00:00’ then following would be 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)
- Related Questions & Answers
- How do I calculate number of days between two dates using Python?
- What is the way to find business days between two specified dates in MySQL?
- MySQL query to calculate the days between two dates from different columns but similar rows
- How do I get the number of days between two dates in JavaScript?
- How to count days between two dates in Java
- Calculate minutes between two dates in C#
- Finding Number of Days Between Two Dates JavaScript
- How to calculate the difference between two dates in JavaScript?
- Find number of days between two given dates in C++
- How to get the number of days between two Dates in JavaScript?
- How do I generate days from the range of dates in MySQL?
- How to query between two dates in MySQL?
- Perform MySQL search between two dates
- How can I generate days from the range of dates with the help of MySQL views?
- Python program to find number of days between two given dates
Advertisements