Free Snowflake Timestamp Converter

1. Epoch or date converter

Current time (UTC): …
Epoch seconds: …
Epoch milliseconds: …


Dates without a time zone are read as UTC. The auto rule follows Snowflake: under 31536000000 means seconds, under 31536000000000 means milliseconds, under 31536000000000000 means microseconds. Larger values mean nanoseconds.

2. Snowflake ID to timestamp (Discord, X)


You run a query and get a date in 1970. Or you see a number like 1700000000 in a table and cannot read it. Or you copy a long Discord ID and want to know when it was made. These problems look different, but each one has a simple fix.

This page gives you a free converter and clear Snowflake SQL for every common task. You will learn how to change a Snowflake timestamp to a date, epoch, UTC, string, number, hour and month. You will also learn how to decode a Snowflake ID. Every example uses the same moment, 2023-11-14 22:13:20 UTC, so you can compare the results easily.

What Does Snowflake Timestamp Converter Mean?

Two different things share the name Snowflake. Pick the row that matches your task.

You work with Your input Your goal Go to
Snowflake data warehouse (SQL) A TIMESTAMP column or a Unix epoch number Convert to date, UTC, string, number and more Sections on SQL below
Snowflake ID (Discord, X, Instagram style) A long 64 bit number Find the time the ID was created Snowflake ID section

Snowflake Timestamp Conversion Cheat Sheet

This table gives the fast answer. Assume ts holds 2023-11-14 22:13:20 as a TIMESTAMP_NTZ value. The sections after it explain the traps.

Task Snowflake SQL Result
Timestamp to date TO_DATE(ts) 2023-11-14
Timestamp to time TO_TIME(ts) 22:13:20
Timestamp to datetime TO_TIMESTAMP_NTZ(ts) 2023-11-14 22:13:20.000
Timestamp to epoch DATE_PART(epoch_second, ts) 1700000000
Timestamp to UTC CONVERT_TIMEZONE('UTC', ts) Same moment in UTC
Timestamp to varchar TO_VARCHAR(ts, 'YYYY-MM-DD HH24:MI:SS') 2023-11-14 22:13:20
Timestamp to number TO_CHAR(ts, 'YYYYMMDD')::NUMBER 20231114
Timestamp to hour HOUR(ts) 22
Timestamp to month MONTH(ts) 11
Current timestamp CURRENT_TIMESTAMP() Now, in the session time zone

Snowflake Timestamp Data Types: NTZ, LTZ and TZ

Most wrong dates come from the data type, not from the function. Snowflake has three timestamp types. The TIMESTAMP name is only an alias. It points to TIMESTAMP_NTZ unless your account changes the TIMESTAMP_TYPE_MAPPING parameter. DATETIME is also another name for TIMESTAMP_NTZ.

Type What it stores Time zone behavior
TIMESTAMP_NTZ A wall clock time No time zone. The value looks the same for every user.
TIMESTAMP_LTZ A moment in time (UTC) Shown in the session time zone.
TIMESTAMP_TZ A moment in time plus a UTC offset Each row keeps its own offset.

Every timestamp type accepts a precision from 0 to 9 digits of fractional seconds. The default is 9, which means nanoseconds.

Snowflake Timestamp to Date, Datetime and Time

Snowflake timestamp to date

Use TO_DATE or the ::DATE cast. Both remove the time part and keep the day.

SELECT TO_DATE('2023-11-14 22:13:20'::TIMESTAMP_NTZ);
SELECT '2023-11-14 22:13:20'::TIMESTAMP_NTZ::DATE;

Both queries return 2023-11-14. For a TIMESTAMP_LTZ column, the date follows the session time zone. A moment late in the evening in New York can fall on the next day in UTC.

Snowflake timestamp to datetime

Snowflake has no separate datetime type. A datetime is a TIMESTAMP_NTZ. To turn a string into a datetime, use TO_TIMESTAMP and add a format when the text is not standard.

SELECT TO_TIMESTAMP('14/11/2023 10:13 PM', 'DD/MM/YYYY HH12:MI AM');

The result is 2023-11-14 22:13:00.000. To drop the zone from a TIMESTAMP_LTZ or TIMESTAMP_TZ value, use TO_TIMESTAMP_NTZ(ts). This keeps the clock digits and removes the offset, so the moment in time can change. Convert to UTC first if you need to keep it.

Snowflake timestamp to time

Use TO_TIME(ts) or ts::TIME. The query returns 22:13:20 for our sample value. The date and the time zone are removed.

Snowflake Timestamp to Epoch and Number

Snowflake timestamp to epoch

The Unix epoch timestamp starts at 1970-01-01 00:00:00 UTC. Use DATE_PART or EXTRACT with an epoch part.

SELECT DATE_PART(epoch_second, ts);
SELECT DATE_PART(epoch_millisecond, ts);
SELECT EXTRACT(epoch_second FROM ts);

For our sample, the first query returns 1700000000 and the second returns 1700000000000. Snowflake also supports epoch_microsecond and epoch_nanosecond. For a TIMESTAMP_NTZ value, Snowflake reads the stored clock as if it were UTC.

Epoch to Snowflake timestamp

Pass a number to TO_TIMESTAMP and set the scale. The scale tells Snowflake the unit. If you skip it, Snowflake assumes seconds.

Unit Scale Digits (today) Example for 2023-11-14 22:13:20 UTC
Seconds 0 10 TO_TIMESTAMP(1700000000, 0)
Milliseconds 3 13 TO_TIMESTAMP(1700000000000, 3)
Microseconds 6 16 TO_TIMESTAMP(1700000000000000, 6)
Nanoseconds 9 19 TO_TIMESTAMP(1700000000000000000, 9)

Snowflake can also guess the unit when the number is stored as text. It checks the size of the value. The cut points are 31536000000 for milliseconds, 31536000000000 for microseconds and 31536000000000000 for nanoseconds. Snowflake marks quoted integers as deprecated input, so a numeric value with an explicit scale is the safer choice.

Snowflake timestamp to number

Snowflake does not accept a timestamp in TO_NUMBER. Choose the number you need instead.

SELECT DATE_PART(epoch_second, ts);
SELECT TO_CHAR(ts, 'YYYYMMDD')::NUMBER;
SELECT TO_CHAR(ts, 'YYYYMMDDHH24MISS')::NUMBER;

These return 1700000000, 20231114 and 20231114221320. Use the epoch for math and sorting. Use the date number for simple keys.

Snowflake Timestamp to UTC

CONVERT_TIMEZONE does this job. It has two forms. The three argument form takes a source zone, a target zone and a TIMESTAMP_NTZ value. The two argument form takes only a target zone and a timestamp.

SELECT CONVERT_TIMEZONE('UTC', ts_ltz);
SELECT CONVERT_TIMEZONE('America/New_York', 'UTC', ts_ntz);
SELECT CONVERT_TIMEZONE('Europe/Warsaw', 'UTC', '2024-01-01 00:00:00'::TIMESTAMP_NTZ);

The last query returns 2023-12-31 23:00:00.000. The three argument form returns a TIMESTAMP_NTZ. The two argument form returns a TIMESTAMP_TZ.

Input type Where Snowflake takes the source zone
TIMESTAMP_TZ From the value itself
TIMESTAMP_LTZ From the session TIMEZONE parameter
TIMESTAMP_NTZ You must name it, or Snowflake uses the session time zone

To make the whole session use UTC, run ALTER SESSION SET TIMEZONE = 'UTC';. Be careful when you cast a TIMESTAMP_TZ to TIMESTAMP_NTZ. The cast keeps the clock digits and drops the offset, so the real moment can move.

Current Snowflake Timestamp

Use CURRENT_TIMESTAMP() for the current time. It returns a TIMESTAMP_LTZ in the session time zone. You can write it with or without parentheses. Add a number from 0 to 9 to control the fractional seconds, such as CURRENT_TIMESTAMP(3).

Function Returns Time zone Parentheses
CURRENT_TIMESTAMP TIMESTAMP_LTZ Session Optional
SYSDATE() TIMESTAMP_NTZ UTC Required
GETDATE(), SYSTIMESTAMP() TIMESTAMP_LTZ Session Required

For the current time in UTC, run SYSDATE() or CONVERT_TIMEZONE('UTC', CURRENT_TIMESTAMP()). For the current epoch in milliseconds, run DATE_PART(epoch_millisecond, CURRENT_TIMESTAMP()).

Your result may hide fractional seconds. The session parameter TIMESTAMP_OUTPUT_FORMAT controls the display, and its default is YYYY-MM-DD HH24:MI:SS.FF3 TZHTZM. Do not use the current timestamp to order queries that run at the same time on one warehouse. They may use different compute resources.

Snowflake Timestamp to Varchar and String Format

TO_VARCHAR and TO_CHAR are the same function. Add a format to control the text. Without a format, Snowflake uses the session output format.

SELECT TO_VARCHAR(ts, 'YYYY-MM-DD HH24:MI:SS');
SELECT TO_VARCHAR(ts, 'DY, DD MON YYYY');
SELECT TO_VARCHAR(ts, 'YYYY-MM-DD"T"HH24:MI:SS.FF3"Z"');
SELECT ts::VARCHAR;

The first three return 2023-11-14 22:13:20, Tue, 14 Nov 2023 and 2023-11-14T22:13:20.000Z. Only add the letter Z when the value is already in UTC. Snowflake advises you to wrap literal letters such as T and Z in double quotes.

Format element Meaning Sample output
YYYY Four digit year 2023
MM Two digit month 11
MON Short month name Nov
MMMM Full month name November
DD Two digit day 14
DY Short day name Tue
HH24 Hour, 00 to 23 22
HH12 with AM Hour, 01 to 12 with AM or PM 10 PM
MI Minute 13
SS Second 20
FF3 Fractional seconds (0 to 9 digits) 000
TZH:TZM Offset from UTC +00:00

Snowflake Timestamp to Hour and Month

Use the short functions for a quick answer. Use DATE_PART when you want one pattern for all parts.

SELECT HOUR(ts), MONTH(ts), MONTHNAME(ts);
SELECT DATE_PART(hour, ts), EXTRACT(month FROM ts);
SELECT TO_CHAR(ts, 'MMMM');
SELECT DATE_TRUNC('hour', ts), DATE_TRUNC('month', ts);

The first query returns 22, 11 and Nov. The third returns November. DATE_TRUNC keeps a full timestamp but resets the smaller parts. It returns 2023-11-14 22:00:00.000 for the hour and 2023-11-01 00:00:00.000 for the month. This helps with hourly and monthly reports.

For a TIMESTAMP_LTZ value, the hour and month follow the session time zone. Convert to UTC first if you group data from users in many regions.

Convert a Snowflake ID to a Timestamp

A Snowflake ID is a 64 bit number made by a system like Discord or X. The top bits hold a time in milliseconds. The lower bits hold machine and sequence data. The time counts from a custom start date, not from 1970.

The steps are short:

  1. Shift the ID right by 22 bits.
  2. Add the epoch of the platform.
  3. Read the result as Unix milliseconds in UTC.
Platform Epoch (ms) Epoch date (UTC) Bit layout
Discord 1420070400000 2015-01-01 00:00:00 42 time, 5 worker, 5 process, 12 increment
X (Twitter) 1288834974657 2010-11-04 01:42:54.657 41 time, 10 machine, 12 sequence

Take the Discord example ID 175928847299117063. Shifting right by 22 bits gives 41944705796. Adding 1420070400000 gives 1462015105796. That is 2016-04-30 11:18:25.796 UTC.

You can also decode an ID inside Snowflake SQL. The number 4194304 equals 2 to the power of 22.

SELECT TO_TIMESTAMP(FLOOR(175928847299117063 / 4194304) + 1420070400000, 3);

The result is 2016-04-30 11:18:25.796. Two traps are common. First, JavaScript numbers lose precision on IDs this large, so use a string or BigInt. Second, the wrong epoch gives a wrong year, and a date in 1970 means you forgot to add an epoch.

Common Snowflake Timestamp Mistakes and Fixes

Problem Likely cause Fix
A date in the far future, or an error Milliseconds read as seconds Add the scale: TO_TIMESTAMP(value, 3)
A date in 1970 Seconds read from a tiny value, or no epoch added to an ID Check the unit and the platform epoch
Time is off by some hours Session time zone or NTZ confusion Use CONVERT_TIMEZONE or set TIMEZONE
Same query, different output for two users Different TIMESTAMP_TYPE_MAPPING or session time zone Cast to an explicit type
Fraction of a second is missing Output format hides it Use TO_CHAR with FF3
Wrong day in daily reports Truncating a local time Convert to UTC before DATE_TRUNC
TO_NUMBER fails on a timestamp Timestamp is not a valid input Use DATE_PART(epoch_second, ts)

Snowflake Timestamp Converter FAQs

How do I convert epoch to a timestamp in Snowflake?

Use TO_TIMESTAMP with a scale. For seconds, run TO_TIMESTAMP(1700000000, 0). For milliseconds, run TO_TIMESTAMP(1700000000000, 3). The result is 2023-11-14 22:13:20 in both cases.

How do I convert a Snowflake timestamp to UTC?

Use CONVERT_TIMEZONE. For a TIMESTAMP_LTZ or TIMESTAMP_TZ value, run CONVERT_TIMEZONE('UTC', ts). For a TIMESTAMP_NTZ value, name the source zone first: CONVERT_TIMEZONE('America/New_York', 'UTC', ts).

What is the difference between TIMESTAMP_NTZ, TIMESTAMP_LTZ and TIMESTAMP_TZ?

TIMESTAMP_NTZ stores a wall clock time with no time zone. TIMESTAMP_LTZ stores a moment in time and shows it in the session time zone. TIMESTAMP_TZ stores a moment in time with its own UTC offset. TIMESTAMP_NTZ is the default for the TIMESTAMP alias.

How do I get the current timestamp in Snowflake?

Run SELECT CURRENT_TIMESTAMP(). It returns a TIMESTAMP_LTZ in the session time zone. Run SELECT SYSDATE() if you need the current time in UTC as a TIMESTAMP_NTZ.

How do I convert a Snowflake timestamp to a string in a custom format?

Use TO_VARCHAR or TO_CHAR with a format. For example, TO_VARCHAR(ts, 'DD MON YYYY HH24:MI:SS') returns 14 Nov 2023 22:13:20.

How do I convert a Snowflake timestamp to a number?

Snowflake does not pass a timestamp to TO_NUMBER. Use DATE_PART(epoch_second, ts) to get Unix seconds. Use TO_CHAR(ts, 'YYYYMMDD')::NUMBER for a number like 20231114.

How do I convert a Discord or X Snowflake ID to a date?

Shift the ID right by 22 bits, then add the platform epoch. Use 1420070400000 for Discord and 1288834974657 for X. The result is Unix time in milliseconds in UTC.

Why does TO_TIMESTAMP return a wrong date?

The most common cause is a wrong unit. A millisecond value read as seconds gives a far future date or an error. Add the scale argument, such as TO_TIMESTAMP(value, 3). The second cause is the time zone of the session.

Final Thoughts

Start with the data type, then pick the function. Use the scale argument for epoch numbers. Use CONVERT_TIMEZONE for UTC. Use TO_VARCHAR for text and DATE_PART for numbers. For Discord or X IDs, shift by 22 bits and add the right epoch. The converter above handles both cases in a few seconds, and the cheat sheet gives the SQL you can copy.

Facts on this page were checked against the official Snowflake documentation in November 2026. See TO_TIMESTAMP, CONVERT_TIMEZONE, CURRENT_TIMESTAMP and date and time formats.