CURRENT_TIME

SQL · Date Functions

Theory

CURRENT_TIME returns the current time of day, such as 14:30:05, without any date attached. Like CURRENT_DATE it is a standard SQL keyword, evaluated when the statement runs, and written without parentheses.

A time-only value is handy when the date does not matter, for example checking which shift is active right now or whether a store is open: WHERE CURRENT_TIME BETWEEN open_time AND close_time. Support differs between databases. PostgreSQL returns a time with time zone, MySQL also offers CURTIME(), SQLite returns 'HH:MM:SS' text in UTC, and SQL Server has no CURRENT_TIME, so you write CAST(GETDATE() AS TIME). Because time values wrap around at midnight, a night shift from 22:00 to 06:00 needs special handling: a simple BETWEEN will not match it.

Why we use it

Some rules depend only on the clock, not the calendar: business hours, shift windows, happy-hour pricing. CURRENT_TIME gives the current time of day directly, so you do not have to strip the date off a full timestamp yourself.

When to use it

Use it for time-of-day checks such as shifts or opening hours. For logging events or measuring durations use CURRENT_TIMESTAMP instead, because a time alone cannot tell you which day something happened.

How it works

  1. Statement starts
  2. Read the server clock
  3. Drop the date, keep hours:minutes:seconds
  4. Does the window cross midnight? Yes: t >= start OR t < end. No: t BETWEEN start AND end.
  5. Return the time or the filtered rows

Syntax

CURRENT_TIME

Example

SELECT CURRENT_TIME;

Key points

SQL topics

Introduction to SQL

Querying Data

Sorting Rows

Limiting Rows

Filtering Rows

Joining Multiple Tables

Grouping Rows

SET Operators

Working with Tables

Modifying Data

Views & Triggers

Conditional Expressions

SQL Subqueries

Aggregate Functions

Window Functions

String Functions

Date Functions

Math Functions

Extra Concepts

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Master SQL from Zero to Pro

All SQL topics in one place. Click any topic in the sidebar — content opens right here without leaving the page.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice SQL Online Solve 150 SQL interview problems in a live editor with instant checking. Start practising →
Section {{ sec.num }}

{{ sec.label }}

SQL  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax
{{ current.syntax }}
Example
{{ current.example }}
▶ Try It Live — runs against a real sample database
{{ liveError }}
{{ col }}
{{ cell }}
Key Points — click to check off as you learn
  • {{ pt.mark }} {{ pt.text }}

Share this topic