Extract a date from a timestamp in Snowflake

How to get a calendar date from a Snowflake timestamp: what each method changes, how time zones affect the result, and how to keep dates readable after export.

Turning a timestamp into a plain calendar date is one of the most common transformations in Snowflake. It is also easy to get subtly wrong. The function call is simple. The judgment calls are which calendar day you actually mean, whether you need a DATE value or a truncated timestamp, and how the result will look once it leaves the database. This review covers what the conversion changes, when it fits, and when a different output is the better choice.

Evidence note: no tested outputs, benchmarks or environment-specific results were supplied for this article. The behavior described below comes from Snowflake's documented functions and data types. The examples are illustrative and show expected results rather than recorded test runs. Results that depend on session settings, client tools or export destinations should be checked in your own account.

Is converting a timestamp to a date suitable for your use?

Converting to DATE is usually the right choice when the question is about days: daily counts, grouping by day, joining to a calendar table, or showing a date column in a report. The main benefit is a clean, comparable value with no time component. Two events on the same day group together, and comparisons against date literals behave predictably.

The decisive tradeoff is that the time of day is discarded, and which day you get depends on the time zone used for the conversion. If the timestamp is stored in UTC and your business day follows US Eastern or Pacific time, events near midnight can land on a different date than readers expect. Resolve the time zone before converting, not after.

Keep the original timestamp alongside the date, or skip the conversion, when ordering within a day matters, when you need durations, or when downstream users may need a different time zone later. Converting the date to explicit text is preferable when the value is headed outside Snowflake, for example into a CSV, an email, a spreadsheet or another system that might reinterpret a typed date.

What the conversion actually changes

This is a data type conversion, not a display effect. Casting a timestamp to DATE produces a new value of a different type. The time portion is removed from the result, and the stored source column is untouched unless you write the result back. That differs from changing the display format, which affects only how a value is rendered as text.

Snowflake offers several equivalent ways to get a DATE from a timestamp, plus related functions that do something different. They are easy to confuse because all of them mention dates:

Expression | Returns | What it does
CAST(ts AS DATE) | DATE | Standard SQL cast; drops the time portion
ts::DATE | DATE | Snowflake shorthand for the same cast
TO_DATE(ts) or DATE(ts) | DATE | Conversion function; same result for timestamp input
DATE_TRUNC('DAY', ts) | Timestamp (same type as input) | Sets the time to midnight but keeps a timestamp type
EXTRACT(YEAR FROM ts), DATE_PART('month', ts), YEAR(ts), DAY(ts) | Number | Pulls out one component, not a full date
TO_CHAR(ts, 'YYYY-MM-DD') | Text (VARCHAR) | Formats the value as a string
-- Illustrative: ts is a TIMESTAMP_NTZ value of 2024-05-10 23:30:00
SELECT
    ts::DATE                  AS as_date,       -- 2024-05-10 (DATE)
    DATE_TRUNC('DAY', ts)     AS truncated,     -- 2024-05-10 00:00:00.000 (timestamp)
    EXTRACT(MONTH FROM ts)    AS month_number,  -- 5 (number)
    TO_CHAR(ts, 'YYYY-MM-DD') AS as_text        -- '2024-05-10' (string)
FROM my_table;

Pick DATE when you want a true date type for grouping, joins and date arithmetic. Pick DATE_TRUNC when a downstream tool or a union expects a timestamp column but you want day-level values. Pick EXTRACT or DATE_PART when you need only the year, month or day number. Pick TO_CHAR only when you specifically want text.

How the timestamp type affects which day you get

Snowflake has three timestamp variants, and they behave differently when converted to a date:

  • TIMESTAMP_NTZ (no time zone): the date is taken from the stored wall-clock value with no conversion.
  • TIMESTAMP_LTZ (local time zone): the value is interpreted in the session's TIMEZONE parameter, so the same row can produce different dates for sessions with different settings.
  • TIMESTAMP_TZ (with offset): the date reflects the wall-clock time at the offset stored with the value.

When you need the calendar day in a specific zone, convert explicitly first. The three-argument form of CONVERT_TIMEZONE takes a source and target zone and returns a TIMESTAMP_NTZ. The two-argument form converts to a target zone and returns a TIMESTAMP_TZ. Either can then be cast to DATE.

-- Calendar day in US Eastern time for a UTC-stored TIMESTAMP_NTZ column
SELECT CONVERT_TIMEZONE('UTC', 'America/New_York', event_ts)::DATE AS event_date_et
FROM events;

Using an IANA zone name such as America/New_York rather than a fixed offset lets the conversion follow daylight saving time changes.

When the source is text or a number

If the timestamp is stored as a string, parse it first with TO_TIMESTAMP and an explicit format, then cast to DATE. An explicit format avoids relying on automatic detection, which can misread ambiguous patterns such as month and day order. If some rows may be malformed, TRY_TO_TIMESTAMP returns NULL instead of raising an error. That keeps the query running, but bad rows can drop out silently, so count the NULLs.

SELECT TRY_TO_TIMESTAMP(raw_ts, 'MM/DD/YYYY HH24:MI:SS')::DATE AS event_date
FROM staging_events;

Epoch values stored as numbers can be converted with TO_TIMESTAMP before casting. Confirm whether the values are in seconds, milliseconds or another unit. The scale changes the result, and this article has no evidence about your specific data.

Filtering by date without changing the column

A filter such as WHERE ts::DATE = '2024-05-10' is readable and correct for many uses. A common alternative is a half-open range on the raw column. It compares the stored timestamp directly and makes the day boundary explicit. No performance measurements were supplied here, so whether the range form is faster for a given table should be checked with the query profile rather than assumed.

SELECT *
FROM events
WHERE event_ts >= '2024-05-10'
  AND event_ts <  '2024-05-11';

The time zone point applies here too. The literal boundaries are interpreted according to the column's timestamp type and the session settings.

Will the result stay readable and usable after copying or sharing?

Inside Snowflake, a DATE is a typed value. How it appears as text is controlled by the DATE_OUTPUT_FORMAT session parameter, which defaults to an ISO-style YYYY-MM-DD layout. Copying from a results grid copies that rendered text, not the underlying type. If the session format has been changed, the copied text changes with it.

Once the value leaves Snowflake, the destination decides how to interpret it. Spreadsheet applications and other import tools may parse date-like text into their own date types and redisplay it in a regional format. For a US audience, YYYY-MM-DD avoids the month-and-day ambiguity of formats like 05/10/2024. Behavior in a specific spreadsheet, BI tool or export pipeline was not tested for this article, so verify with a sample file in the actual destination.

  • Need a value that survives any destination unchanged: output text with TO_CHAR(date_col, 'YYYY-MM-DD') and treat the column as text on import.
  • Need the destination to do date math or sorting: export a typed DATE and confirm the import recognizes it as a date.
  • Need day-of-week or a human-friendly label for a report: add a separate formatted text column and keep the DATE column for logic.
  • Need both the day and the exact moment: keep the original timestamp in the output alongside the date.

Accessibility depends mostly on the report or application that displays the date, not on the Snowflake conversion. No assistive technology testing was supplied here, so no claims are made about how particular screen readers announce numeric date formats. If a report will be read with assistive technology, consider offering a spelled-out date label and test it with the tools your readers use.

Bottom line

For day-level analysis in Snowflake, ts::DATE, CAST or TO_DATE are reliable and equivalent ways to extract a date from a timestamp. Before relying on the result, check two things. First, settle the time zone, especially for TIMESTAMP_LTZ columns or UTC data reported on a US business day. Second, decide whether consumers outside Snowflake need typed dates or fixed text. Keep the original timestamp when the time of day might matter later. Confirm session settings and export behavior in your own environment, because those were not tested here.