If you’re happy to ignore the time portion in the columns, DATEDIFF() will give you the difference you’re looking for in days.
SELECT DATEDIFF('2010-10-08 18:23:13', '2010-09-21 21:40:36') AS days;
+------+
| days |
+------+
| 17 |
+------+
More Related Contents:
- Should I use the datetime or timestamp data type in MySQL?
- MySQL convert date string to Unix timestamp
- Timestamp with a millisecond precision: How to save them in MySQL
- Group mysql query by 15 min intervals
- MySQL Query GROUP BY day / month / year
- Error in MySQL when setting default value for DATE or DATETIME
- MySQL datetime fields and daylight savings time — how do I reference the “extra” hour?
- MySQL Query to select data from last week?
- How to get the difference between two timestamps in seconds
- Why there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT clause?
- How to select date from datetime column?
- How to convert number of week into date?
- Set NOW() as Default Value for datetime datatype?
- SQL Query to show nearest date?
- How to subtract hours from a datetime in MySQL?
- How to convert time to the time zone of the iPhone device?
- Select data between a date/time range
- mysql: get record count between two date-time
- How to cast DATETIME as a DATE in mysql?
- How to get current date & time in MySQL?
- how to cast the hexadecimal to varchar(datetime)?
- MySQL CURRENT_TIMESTAMP on create and on update
- Use MySQL to determine whether today is a user’s birthday
- When is a timestamp (auto) updated?
- Using MySQL’s TIMESTAMP vs storing timestamps directly
- MySQL column type “TIMESTAMP” implicitly includes “NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP”
- how to partition a table by datetime column?
- How do I alter a mysql table column defaults?
- MySQL: Insert datetime into other datetime field
- Working with INTERVAL and CURDATE in MySQL