CURRENT_DATE returns today’s date (00:00:00) as a DATE value in Redshift and PostgreSQL.
CURRENT_DATE is a built-in, zero-argument function that returns the current date based on the cluster’s time zone. The time component is set to 00:00:00, so the result is of type DATE, not TIMESTAMP.
Run SELECT CURRENT_DATE;
and Redshift will return the date for the moment the query starts. No parentheses are required, but CURRENT_DATE()
also works.
Yes. You can add or subtract integer days. Example: CURRENT_DATE - 7
returns the date seven days ago; CURRENT_DATE + 30
returns the date 30 days ahead.
Because CURRENT_DATE has no time, combine it with CURRENT_TIMESTAMP
when you need precision. Example filter: WHERE order_date >= CURRENT_DATE - 1
includes all yesterday’s rows.
All three return TIMESTAMP values. Use them when you need both date and time. CURRENT_DATE is best when time is irrelevant and you want implicit midnight truncation.
Compare DATE to DATE and TIMESTAMP to TIMESTAMP. Mixing types forces implicit casts that prevent index use and slow queries.
Yes. It returns the date according to the session’s current time zone setting.
Yes. All references to CURRENT_DATE in a single statement return the same value, ensuring consistency.
Absolutely. Define a DATE column with DEFAULT CURRENT_DATE
to auto-populate the field on INSERT.