MySQL DATEDIFF Function

Wednesday, December 28, 2011

tags SQL

The MySQL DATEDIFF function returns the difference in time between two dates.

Syntax

DATEDIFF(dateA, dateB)


Example
SELECT DATEDIFF('2011-12-31','2011-12-30') AS [Date Difference]


Results

Date Difference
1

Did you find the page informational and useful? Share it using one of your favorite social sites.

Recommended Books & Training Resources

Head First SQL: Your Brain on SQL A Learners Guide SQL Cookbook