Extract a Calendar Date from a Datetime Value in Redshift

How to get a calendar date from a timestamp in Amazon Redshift: what CAST, TRUNC, DATE_TRUNC, TO_CHAR and EXTRACT return, plus time zone and export caveats.

Getting only the calendar date from a timestamp in Amazon Redshift is usually a one-line conversion. Several similarly named functions return different data types, though, and time zones can change which date you end up with. This review explains what each common approach changes, whether the result stays usable after export, and when a text-formatted date is the better choice.

Short recommendation

For most work, use CAST(column AS DATE) or the shorthand column::date. The result has the DATE type, so it sorts, compares and joins correctly against other date columns. The tradeoff is that the time of day is discarded in that result. For TIMESTAMPTZ values, the calendar date also depends on the time zone used to interpret the value. Use a formatted text string from TO_CHAR only at an output boundary, such as a file or report that needs a fixed pattern and will not be used for further date calculations. Keep the original timestamp alongside the date if you might need hours, minutes or exact ordering later.

What the conversion actually changes

Casting to DATE changes both the value and its type. A DATE holds no time component. A timestamp of 2026-03-14 18:45:00 becomes 2026-03-14, and the 18:45 is not recoverable from the result. The source column is unaffected unless you write the converted value back with an UPDATE or a new table.

Formatting is a different operation. TO_CHAR(ts, 'YYYY-MM-DD') produces text that looks like a date but is a VARCHAR. Redshift will treat it as a string in comparisons, sorting and joins unless it is converted back.

"Extract" means something narrower in SQL

In a query like "redshift extract date from datetime", the word "extract" usually means "get the date part." The SQL EXTRACT function does something narrower. EXTRACT(day FROM ts) and DATE_PART('day', ts) each return a single numeric field, such as 14 for the day of the month. They do not return a full calendar date. They are the right tool when you want the year, month or weekday on its own, not when you want 2026-03-14 as a date.

Expression | Returns | Time of day | Typical use
CAST(ts AS DATE) or ts::date | DATE | Dropped | General-purpose date extraction
TRUNC(ts) | DATE | Dropped | Redshift shorthand with the same purpose
DATE_TRUNC('day', ts) | Timestamp value | Set to midnight | Downstream code expects a timestamp, not a date
TO_CHAR(ts, 'YYYY-MM-DD') | VARCHAR | Not present in the text | Fixed-format output for files or labels
EXTRACT(day FROM ts) | Number | Not applicable | A single field such as day, month or year
SELECT
    event_ts,
    event_ts::date                  AS event_date,
    TRUNC(event_ts)                 AS event_date_trunc,
    DATE_TRUNC('day', event_ts)     AS event_day_start,
    TO_CHAR(event_ts, 'YYYY-MM-DD') AS event_date_text,
    EXTRACT(day FROM event_ts)      AS day_of_month
FROM events;

Time zones decide which calendar date you get

A TIMESTAMP without a time zone carries no zone information, so casting it to DATE simply drops the time. TIMESTAMPTZ values are stored in UTC and interpreted relative to a time zone. An event at 02:30 UTC still falls on the previous evening in US time zones, so the "correct" date depends on whose calendar matters. When the date should reflect a particular local time, convert explicitly before casting. With a single time zone argument, CONVERT_TIMEZONE assumes the source is UTC.

SELECT CONVERT_TIMEZONE('America/New_York', event_ts)::date AS local_event_date
FROM events;

No test results were supplied for this review. Before relying on the output in reporting, confirm how a direct TIMESTAMPTZ-to-DATE cast behaves under your session's time zone setting by checking current Redshift documentation and running a query on rows near midnight.

When the source is text rather than a timestamp

If datetimes are stored as strings, convert them with TO_DATE and an explicit format, for example TO_DATE(created_at_text, 'YYYY-MM-DD HH24:MI:SS'). The format must match the data. A string such as 03/04/2026 is ambiguous, and the pattern you supply determines whether it is read as March 4 or April 3. Check a sample of converted rows against the source before using the results.

Will the result remain usable after export or sharing?

Inside Redshift, a DATE column keeps its type and behaves predictably. Once results leave the database, through UNLOAD, a client export or copying from a query tool, they become text in whatever format that tool writes. Spreadsheets and other destinations may reinterpret that text or display it in a locale-specific pattern, such as month/day/year in US settings. This review does not cover how any specific destination behaves, so test the actual handoff before depending on it.

Plain text is needed when the receiving system expects an exact pattern. In that case, apply TO_CHAR at the export step and keep DATE in your tables. Text dates sort chronologically only in year-month-day order, such as 2026-03-14. Other patterns sort alphabetically and fall out of order. An ISO-style date also reads unambiguously wherever it is pasted, including with assistive technology that reads the displayed text. No specific screen reader was tested here.

Filtering by date without wrapping the column

Wrapping a column in a function inside a WHERE clause, such as WHERE event_ts::date = '2026-03-14', returns correct rows but can make it harder for Redshift to skip data blocks based on the sort key. A half-open range on the original timestamp returns the same day's rows and keeps the column unwrapped. Compare the two forms with EXPLAIN on your own tables, because the effect depends on table design.

SELECT *
FROM events
WHERE event_ts >= '2026-03-14'
  AND event_ts <  '2026-03-15';

Gaps in this review

No cluster-specific evidence, version details or test results were supplied. The behavior described here reflects generally documented Redshift functions, not observations from a particular environment. Verify return types, time zone handling and export formatting against current documentation and a small test query before using the approach in production reports.