INTERVAL (DateTime)

Adds a specified number of seconds, minutes, or hours to a datetime

Description

The INTERVAL function enables you to perform datetime arithmetic by adding or subtracting a specified number of seconds, minutes, or hours to a given datetime. This is useful for scheduling, time-based calculations, or event planning.

Syntax

datetime + INTERVAL number SECOND/MINUTE/HOUR

  1. datetime: The initial datetime value to which you want to apply the interval.

  2. number: The numeric value representing the amount you want to add or subtract.

  3. SECOND/MINUTE/HOUR: Specify the time unit (second, minute, or hour) for the interval.

Example

Table

Meeting
Start Time

Team Meeting

2023-09-05 09:00:00

Project Kickoff

2023-09-10 14:30:00

Training

2023-09-15 10:00:00

Function

`Start Time` + INTERVAL 30 MINUTE

Results

INTERVAL (datetime)

2023-09-05 09:30:00

2023-09-10 15:00:00

2023-09-15 10:30:00

Last updated