Learn SQL/Beginner/Data Types & Casting/SQL TIMESTAMP Data Type

SQL TIMESTAMP Data Type

A date AND a time together — down to fractional seconds, optionally aware of timezone.

What & Why

TIMESTAMP stores both a calendar date and a time of day. Postgres offers two variants: TIMESTAMP (no timezone awareness — stores exactly the value given) and TIMESTAMPTZ (timezone-aware — stored internally in UTC, converted for display based on the session's timezone setting).

See How It Works

REFERENCE EXAMPLE
ValueType
2024-01-15DATE
2024-01-15 09:30:00TIMESTAMP
2024-01-15 09:30:00+00TIMESTAMPTZ

The result uses the same Queryflo columns shown in the worked example.

Beginner business practice

Sign up free to try it on a real business scenario