SQL TO_TIMESTAMP

TO_DATE's counterpart for timestamps — parses text into a full date-and-time value using an explicit format.

What & Why

TO_TIMESTAMP(text, format) works exactly like TO_DATE, but produces a full TIMESTAMP — parsing time-of-day components (hours, minutes, seconds) in addition to the date.

See How It Works

BUSINESS QUESTION

Growth checks that a user's stored signup moment survives an epoch round trip.

idcreated_atcountrychannelplanactivated_atchurned_at
1012024-01-15 09:10:00+00USorganicpro2024-01-16 14:25:00+00NULL
1022024-02-10 11:05:00+00CApaidfreeNULL2024-03-20 10:00:00+00
1032024-03-12 16:35:00+00GBreferralpro2024-03-13 08:15:00+00NULL
1042024-04-01 13:20:00+00USorganicfree2024-04-03 12:00:00+00NULL
EXAMPLE QUERY
SELECT
  id AS user_id,
  EXTRACT(EPOCH FROM created_at) AS epoch_seconds,
  TO_TIMESTAMP(EXTRACT(EPOCH FROM created_at)) AS parsed_created_at
FROM growth.users
ORDER BY user_id;
RESULT — exact output from the displayed Queryflo rows
user_idepoch_secondsparsed_created_at
1011705309800.0000002024-01-15 09:10:00+00
1021707563100.0000002024-02-10 11:05:00+00
1031710261300.0000002024-03-12 16:35:00+00
1041711977600.0000002024-04-01 13:20:00+00

The epoch round trip reproduces every displayed signup moment.

Intermediate business practice

Sign up free to try it on a real business scenario