Showing posts with label mysql datediff function. Show all posts
Showing posts with label mysql datediff function. Show all posts

Monday, 16 July 2012

Mysql DATEDIFF function

Mysql DATEDIFF(arg1,arg2) function
DATEDIFF() function returns arg1 – arg2. Value is expressed in term of days. arg1 and arg2 are either date or date-and-time expressions. Only date part is used for calculation.
SELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30');
o/p: 1
SELECT DATEDIFF('2010-11-30 23:59:59','2010-12-31');
o/p: -31