Diff Date Mysql. The syntax of the mysql datediff function is as follows. Period diff p1 p2 returns the number of months between periods p1 and p2.
The datediff function accepts two arguments that can be any valid date or date time values. Mysql select date 2003 12 31 01 02 03. Period diff p1 p2 returns the number of months between periods p1 and p2.
When working with mysql database and trying to figure out how to find datediff in mysql all you have to do is use the mysql datediff function.
Note that the period arguments p1 and p2 are not date values. Expr1 and expr2 are date or date and time expressions. The way it works is you provide two arguments one for each date and datediff will return the number of days between the two dates. Introduction to mysql datediff function.