INTERVAL (DateTime)

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

Updated over a week ago

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

Output

datetime

  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 1

`Start Time` + INTERVAL 30 MINUTE

Meeting

Start Time

INTERVAL

Team Meeting

2023-09-05T05:00:00000

2023-09-05T05:30:00000

Project Kickoff

2023-09-10T10:30:00000

2023-09-10T11:00:00000

Training

2023-09-15T06:00:00000

2023-09-15T06:30:00000

Example 2

`Start Time` + INTERVAL 15 SECOND

Meeting

Start Time

INTERVAL

Team Meeting

2023-09-05T05:00:00000

2023-09-05T05:00:15000

Project Kickoff

2023-09-10T10:30:00000

2023-09-10T10:30:15000

Training

2023-09-15T06:00:00000

2023-09-15T06:00:15000

Example 3

`Start Time` + INTERVAL 12 HOUR

Meeting

Start Time

INTERVAL

Team Meeting

2023-09-05T05:00:00000

2023-09-05T17:00:00000

Project Kickoff

2023-09-10T10:30:00000

2023-09-10T22:30:00000

Training

2023-09-15T06:00:00000

2023-09-15T18:00:00000

Did this answer your question?