Adds a time interval to a DATETIME value. Supports all units from MICROSECOND to YEAR.
DATETIMEDiperbarui: 13 Jun 2026DATETIME_ADD(datetime_expression, INTERVAL int64_expression datetime_part)The starting DATETIME value
The number of intervals to add
Interval unit: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, etc.
1 SELECT 2 DATETIME '2024-01-15 10:00:00' as original, 3 DATETIME_ADD(DATETIME '2024-01-15 10:00:00', INTERVAL 2 HOUR) as plus_2h, 4 DATETIME_ADD(DATETIME '2024-01-15 10:00:00', INTERVAL 1 DAY) as plus_1d, 5 DATETIME_ADD(DATETIME '2024-01-15 10:00:00', INTERVAL 1 MONTH) as plus_1m;
Add various intervals to a datetime value.
| original | plus_2h | plus_1d | plus_1m |
|---|---|---|---|
| 2024-01-15T10:00:00 | 2024-01-15T12:00:00 | 2024-01-16T10:00:00 | 2024-02-15T10:00:00 |
1 SELECT 2 appointment_id, 3 scheduled_datetime, 4 DATETIME_ADD(scheduled_datetime, INTERVAL 1 HOUR) as end_time, 5 DATETIME_ADD(scheduled_datetime, INTERVAL -15 MINUTE) as reminder_time 6 FROM `project.dataset.appointments`;
Calculate the end time and reminder time for appointments.
Sudah paham DATETIME_ADD? Latih langsung di browser
Latihan interaktif, langsung di browser.