DATE_ADD

Date function

Description

The DATE_ADD function in Amazon Redshift adds a specified time interval to a date or timestamp. Where datetimepart is the type of interval (like 'day' or 'month'), interval is the number of units to add (positive or negative), and timestamp is the original date.

DATE_ADD is converted to DATEADD, for more information about this conversion click here.

Valid datepart in Snowflake for DATE_ADD:

  • microsecond, microseconds

  • millisecond, milliseconds

  • second, seconds

  • minute, minutes

  • hour, hours

  • day, days

  • week

  • month, months

  • quarter, quarters

  • year, years

Unsupported formats in Snowflake for DATE_ADD:

  • weeks

  • decade, decades

  • century, centuries

  • millennium, millennia

Grammar Syntax

DATE_ADD( datetimepart, interval, timestamp )

Sample Source Patterns

Input Code:

IN -> Redshift_01.sql
SELECT DATE_ADD('day', 10, '2024-11-01'), DATE_ADD('month', 3, '2024-11-01');

SELECT "DATE_ADD"('DAYS',18,'2008-02-28');

Output Code:

OUT -> Redshift_01.sql
SELECT
DATEADD('day', 10, '2024-11-01'),
DATEADD('month', 3, '2024-11-01');

SELECT
DATEADD('DAYS',18,'2008-02-28');

Know Issues

No issues were found.

There are no known issues.

Last updated