Loading

MySQL TIMESTAMPDIFF Function

TIMESTAMPDIFF() function returns the difference or subtractions of a given two date-time.

Syntax of TIMESTAMPDIFF(unit, timestamp_exp1, timestamp_exp2 )

Here unit may be FRAC_SECOND (microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.

timestamp_exp1 will be the first DateTime or date

timestamp_exp2 will be the second DateTime or date

Note:- first expression can be DateTime and the second expression can be the only date. or vise versa.

SELECT TIMESTAMPDIFF(MONTH,’20013-03-02′,’20033-06-03′);

Share with:


Leave a Reply

Connect with:





z35W7z4v9z8w