Mysql Function: The difference between two dates in months

by rajesh 2012-05-17 15:02:36

To find the different between 2 dates in months:

Use PeriodDiff mysql function
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_period-diff


Example:
select period_diff(date_format(date1row, '%Y%m'), date_format(date2row, '%Y%m')) as months from your_table;

Tagged in:

1145
like
0
dislike
0
mail
flag

You must LOGIN to add comments