TIME_PERIOD_OFFSET

Calculates the number of time periods between a given date and the current period

Description

The TIME_PERIOD_OFFSET() function calculates and returns the number of time periods (e.g., day, week, month, quarter, year, decade) between a given date or datetime and the current period. This is useful for determining how far a date is from the current time period.

Syntax

TIME_PERIOD_OFFSET(date, "day"/"week"/"month"/"quarter"/"year"/"decade")

  1. date: The date for which you want to calculate the time period offset.

  2. "day"/"week"/"month"/"quarter"/"year"/"decade": The time period to use for calculating the offset.

Example

Table

Event
Event Date

Event A

2023-09-10

Event B

2024-02-25

Event C

2023-12-01

Event D

2022-04-15

Function

TIME_PERIOD_OFFSET(`Event Date`, "month")

*As of September 22, 2023

Results

TIME_PERIOD_OFFSET (integer)

-6

1

-3

-18

Last updated