Now I am describing how to add a specific datetime unit in date. TIMESTAMPADD function of mysql is very important when we are working on datetime part in mysql query.This function takes integer INTERVAL argument and return result datetime with given unit interval.
The unit and interval both are must be same unit type().which should be one of the following values: MICROSECOND(microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.
The Syntax is:
TIMESTAMPADD(unit,interval,datetime_expr)
Unit: Its unit type of interval, which you want add.
Interval : the integer value of ‘unit’ type
Exp: target datetime value
Example:
SELECT TIMESTAMPADD(WEEK,1,Now())
Result: 2012-05-21 17:27:25