Return the current time-of-day without time zone information.
LOCALTIME
## Overview Returns the current time-of-day (hours, minutes, seconds, fractional seconds) without any time zone information. The value is based on the session time zone but does not carry a zone offset in the result. Use LOCALTIME when you want a naive time value suitable for direct comparison with zone-less TIME literals, for example comparing to fixed schedule windows. ## Behavior - Returns a TIME 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 TIME literals and other TIME WITHOUT TIME ZONE values. ## Timezone handling - The underlying clock reading is taken in the session time zone, but the zone is not part of the returned value. - Mixing LOCALTIME with TIME WITH TIME ZONE expressions forces an implicit conversion that reinterprets the naive time in the session zone. - Use CURRENT_TIME when zone-aware arithmetic is required. ## Compatibility - Defined in the SQL standard (ANSI/ISO SQL:2016). An optional precision argument (LOCALTIME(p)) controls fractional-second precision in some dialects.
-- Current local time without zone
SELECT LOCALTIME;
-- Contrast with CURRENT_TIME (which carries time zone)
SELECT LOCALTIME AS local_t, CURRENT_TIME AS current_t;
-- Extract the minute component
SELECT EXTRACT(MINUTE FROM LOCALTIME) AS current_minute;
-- Compare against a stored shift window
SELECT shift_name
FROM workforce.scheduling.shifts
WHERE LOCALTIME BETWEEN shift_start AND shift_end;
-- Combine with CURRENT_DATE to build a TIMESTAMP
SELECT (CURRENT_DATE() + LOCALTIME)::TIMESTAMP AS now_local;