Return the current date and time without time zone information.
LOCALTIMESTAMP
## Overview Returns the current date and time as a TIMESTAMP value without any time zone offset. The underlying clock reading is taken in the session time zone, but the returned value is a naive TIMESTAMP that does not carry zone information. Use LOCALTIMESTAMP when your schema stores naive TIMESTAMP values and you want to avoid implicit time zone conversions. Use CURRENT_TIMESTAMP when an instant-in-time (zone-aware) semantic is required. ## Behavior - Returns a TIMESTAMP WITHOUT TIME ZONE value. - Never returns NULL. - Stable within a transaction: repeated calls return the same value. - Spelled as a bare keyword (no parentheses), matching the SQL standard. - Comparable directly to TIMESTAMP WITHOUT TIME ZONE values. Comparison with TIMESTAMP WITH TIME ZONE applies an implicit conversion in the session zone. ## Timezone handling - The clock is read in the session zone, then the zone metadata is dropped. - Changing the session zone mid-transaction does not change the value once fixed. - Prefer CURRENT_TIMESTAMP (or NOW()) for strict instant semantics and cross-zone safety. ## Compatibility - Defined in the SQL standard (ANSI/ISO SQL:2016). An optional precision argument (LOCALTIMESTAMP(p)) controls fractional-second precision in some dialects.
-- Current local timestamp without time zone
SELECT LOCALTIMESTAMP;
-- Contrast LOCALTIMESTAMP (no zone) with CURRENT_TIMESTAMP (with zone)
SELECT LOCALTIMESTAMP AS local_ts, CURRENT_TIMESTAMP() AS current_ts;
-- Insert a zone-less timestamp into an event table
INSERT INTO analytics.events.user_activity (event_name, event_ts)
VALUES ('login', LOCALTIMESTAMP);
-- Compute age relative to LOCALTIMESTAMP
SELECT order_id, LOCALTIMESTAMP - placed_at::TIMESTAMP AS age
FROM commerce.sales.orders;
-- Filter rows in the last hour using the zone-less clock
SELECT COUNT(*) AS recent_events
FROM telemetry.web.requests
WHERE event_ts >= LOCALTIMESTAMP - INTERVAL '1 hour';