Notification

This article is about Looker Studio. For Looker documentation, visit https://cloud.google.com/looker/docs/intro.

DATETIME_ADD

Adds a specified time interval to a date.

Sample usage

DATETIME_ADD(Order Date, INTERVAL 1 WEEK)

Syntax

DATETIME_ADD(datetime_expression, INTERVAL integer part)

Parameters

  • datetime_expression - a Date or a Date & Time field or expression.
  • integer - a whole numeric field or expression representing the number of parts to add.
  • part - the unit of time measurement to add. DATETIME_ADD supports the following values for part:
    • MICROSECOND: available for Date & Time fields or expressions.
    • MILLISECOND: available for Date & Time fields or expressions.
    • SECOND: available for Date & Time fields or expressions.
    • MINUTE: available for Date & Time fields or expressions.
    • HOUR: available for Date & Time fields or expressions.
    • DAY
    • WEEK. Equivalent to 7 DAYs.
    • MONTH
    • QUARTER
    • YEAR

Return data type

Date & Time

Examples

Formula Result (using Date & Time data type)
DATETIME_ADD(DATETIME "2023-01-25 15:30:00", INTERVAL 10 MINUTE)

Jan 25, 2023, 3:40:00 PM

DATETIME_ADD(DATE "2023-01-25", INTERVAL 5 DAY)

Jan 30, 2023, 12:00:00 AM

Notes

This function is not available for compatibility mode date types.

When using MONTH, QUARTER, or YEAR parts, if the resulting date is at (or near) the last day of the month, DATETIME_ADD returns the last day of the month. This can happen when the month in the resulting date has fewer days than the month in the starting date.

For example, if Date = August 31, 2020, DATETIME_ADD(Date, INTERVAL 1 MONTH) returns September 30, 2020.

Related resources

Was this helpful?

How can we improve it?
true
What's new in Looker Studio?

Learn about new features and recent changes. Looker Studio release notes live on Google Cloud.

Search
Clear search
Close search
Main menu
16464453544707846723
true
Search Help Center
true
true
true
true
true
102097
false
false