SQL Keywords

SQL CURRENT_TIME

What is SQL CURRENT_TIME?

Returns the current time of day for the session, optionally to a specified fractional-seconds precision.
Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Compatible dialects for SQL CURRENT_TIME: PostgreSQL, MySQL, MariaDB, SQL Server (2008+), SQLite, DuckDB. Not supported in Oracle (use CURRENT_TIMESTAMP).

SQL CURRENT_TIME Full Explanation

CURRENT_TIME is a non-deterministic SQL datetime keyword that evaluates to the current time when the statement starts executing. It follows the session or server time zone unless the dialect appends a time-zone qualifier. Its return type is TIME [ (p) ] where p ranges from 0 to 6 fractional-second digits. CURRENT_TIME is evaluated once per statement, so multiple references within the same query yield the same value. It can be used anywhere an expression is allowed: SELECT lists, WHERE clauses, CHECK constraints, column defaults, and stored procedures. In PostgreSQL and SQL Server the value includes a time-zone offset (TIME WITH TIME ZONE), whereas MySQL and SQLite return a time without offset. Because it is non-deterministic, most databases forbid its use in deterministic, indexed, or generated columns unless marked VOLATILE or NONDETERMINISTIC.

SQL CURRENT_TIME Syntax

CURRENT_TIME
CURRENT_TIME ( precision )

SQL CURRENT_TIME Parameters

  • precision (INTEGER) - Optional. Number of fractional-second digits (0-6). Default is database-specific (usually 6).

Example Queries Using SQL CURRENT_TIME

-- Basic retrieval
SELECT CURRENT_TIME;

-- Millisecond precision
SELECT CURRENT_TIME(3);

-- Default value in a table
CREATE TABLE logs (
  id SERIAL PRIMARY KEY,
  event_time TIME DEFAULT CURRENT_TIME
);

-- Compare with a stored value
SELECT *
FROM sessions
WHERE start_time < CURRENT_TIME;

Expected Output Using SQL CURRENT_TIME

#VALUE!

Use Cases with SQL CURRENT_TIME

  • Capture start or end times in audit tables
  • Populate TIME columns with default values
  • Filter rows against the current clock time
  • Build time-based access rules in CHECK constraints
  • Quick debugging to verify server time-zone settings

Common Mistakes with SQL CURRENT_TIME

  • Expecting the date part – CURRENT_TIME returns only a time, not a full timestamp
  • Forgetting parentheses around precision: use CURRENT_TIME(3), not CURRENT_TIME 3
  • Assuming deterministic behavior in indexed generated columns
  • Misunderstanding time-zone handling across databases
  • Using as a constant in long-running transactions where time drift matters

Related Topics

CURRENT_DATE, CURRENT_TIMESTAMP, LOCALTIME, LOCALTIMESTAMP, NOW(), SYSDATE

First Introduced In

SQL-92

Frequently Asked Questions

Does CURRENT_TIME show the server or client time?

It shows the server or session time zone, not the client machine’s clock. Check or set your session time zone if results look unexpected.

How can I store the time a row was inserted?

Define the column with a default: `created_time TIME DEFAULT CURRENT_TIME`. Every new row receives the current clock time automatically.

Why does PostgreSQL CURRENT_TIME include a +00 offset?

PostgreSQL returns `TIME WITH TIME ZONE` by default, so the value contains a signed offset (e.g., 15:04:17.123456+00). Cast to `TIME` if you need to drop the offset.

What precision should I use for logging events?

Use `CURRENT_TIME(6)` for microsecond detail when troubleshooting high-frequency events; `CURRENT_TIME(3)` suffices for most application logs.

Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.
Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo

Check out other commonly used SQL Keywords!