amazon-redshiftHow do I use the Amazon Redshift Dateadd function?
The DATEADD
function in Amazon Redshift is used to add or subtract a specified time interval from a given date. It takes three parameters: an interval type, a number, and a date.
SELECT DATEADD(day, 10, '2018-12-25');
Output example
2018-01-04
This example adds 10 days to the date 2018-12-25
and returns the result 2018-01-04
.
The interval type is one of the following: year
, quarter
, month
, day
, hour
, minute
, second
, millisecond
.
The number is the number of interval types to add or subtract.
The date is the date to which the interval is added or subtracted.
Helpful links
More of Amazon Redshift
- How do I use Amazon Redshift with YouTube?
- How do I use Amazon Redshift window functions?
- How can I monitor Amazon RDS using Zabbix?
- How do I use Amazon Redshift to store data in an S3 bucket?
- How do I use Amazon Redshift RSQL to query data?
- How do I use the Amazon Redshift YEAR function?
- How can I use Amazon Redshift to store and process unstructured data?
- How can I handle divide by zero errors when using Amazon Redshift?
- How do I set up Amazon RDS with Multi-AZ for high availability?
- How can I use Amazon Redshift UNION to combine data from multiple tables?
See more codes...