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
- Statement starts
- Read the server clock
- Drop the date, keep hours:minutes:seconds
- Does the window cross midnight? Yes: t >= start OR t < end. No: t BETWEEN start AND end.
- Return the time or the filtered rows
Syntax
CURRENT_TIMEExample
SELECT CURRENT_TIME;Key points
- Returns time only, no date portion
- Time zone handling varies by database
- SQL Server has no CURRENT_TIME — use CAST(GETDATE() AS TIME)
- SQLite returns UTC text like '14:30:05'; MySQL also has CURTIME()
- Windows that cross midnight (22:00–06:00) need an OR condition, not BETWEEN