Adds an interval to a datetime value. Returns the new datetime after the addition.
DATETIMEDiperbarui: 13 Jun 2026TIMESTAMPADD(unit, interval, datetime)The interval unit (YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, etc.)
Number of units to add (can be negative)
The starting datetime value
1 SELECT TIMESTAMPADD(DAY, 7, '2024-01-15 10:00:00') AS result;
Add 7 days.
1 SELECT TIMESTAMPADD(HOUR, -3, NOW()) AS three_hours_ago;
Three hours ago from the current time.
1 SELECT order_id, 2 TIMESTAMPADD(DAY, delivery_days, order_date) AS due_date 3 FROM orders;
Calculate the expected delivery date.
Sudah paham TIMESTAMPADD? Latih langsung di browser
Latihan interaktif, langsung di browser.