Lesson

MySQL CURRENT_TIME() Function

10 min reading
Free Course

MySQL CURRENT_TIME(): Get the Session Clock Time

The CURRENT_TIME keyword and CURRENT_TIME() function return the current time of day in your session time zone. It acts as the ANSI SQL synonym for CURTIME() and optionally accepts a fractional-seconds precision argument.

Attendance logs, batch schedulers, and time-of-day routing rules use CURRENT_TIME() to check against business operating hours.

Syntax

MySQL allows three valid ways to write this function:

CURRENT_TIME
CURRENT_TIME()
CURRENT_TIME(fsp)
  • fsp: Optional integer literal from 0 to 6 specifying fractional seconds precision (microseconds). Omitting fsp defaults to 0.

In string context, it returns 'HH:MM:SS' or 'HH:MM:SS.ffffff'. In numeric context (CURRENT_TIME + 0), it returns HHMMSS or HHMMSS.ffffff.

Practical Example

Suppose you check which warehouse staff in demo_employees have shifts ending after the current clock time, rounded to millisecond precision (fsp = 3).

SELECT
    employee_id,
    full_name,
    daily_cutoff_time,
    CURRENT_TIME(3) AS checked_at
FROM demo_employees
WHERE daily_cutoff_time > CURRENT_TIME();
employee_id full_name daily_cutoff_time checked_at
21 Priya Nair 17:30:00 14:22:09.418
22 Samira Patel 18:00:00 14:22:09.418

Both rows share the exact same checked_at timestamp because MySQL evaluates CURRENT_TIME() once per statement.

Common Mistakes & NULL Behavior

Watch for these rules when calling CURRENT_TIME():

  • Immune to NULL column inputs: Because CURRENT_TIME() takes no required data input, NULL fields in demo_employees will not cause CURRENT_TIME() to fail or return NULL.
  • fsp must be a literal 0 through 6: Passing CURRENT_TIME(7), negative numbers, or a column name triggers a syntax error.
  • No date portion: CURRENT_TIME() only contains hours, minutes, and seconds. Do not compare it directly to DATETIME columns; compare against TIME values instead.
  • Bad numeric math: Adding CURRENT_TIME + 100 uses base-10 integer arithmetic and can produce invalid clock values like 145965. Use ADDTIME(CURRENT_TIME(), '00:01:00') instead.

Frequently Asked Questions

What is the difference between CURRENT_TIME and CURRENT_TIME(6)?

CURRENT_TIME returns whole seconds like '14:22:09', whereas CURRENT_TIME(6) includes six fractional digits for microseconds like '14:22:09.418205'.

Does CURRENT_TIME() return UTC time or local time?

It returns the time in the MySQL session's time_zone variable. Use UTC_TIME() if you specifically need Coordinated Universal Time.

Can I pass a column into CURRENT_TIME()?

No. CURRENT_TIME() only accepts an optional integer precision 0..6. To extract time from a DATETIME column, use TIME(col).

Save Your Progress

Unlock Your
Full Potential.

Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.

Quick Access With

Enterprise-Grade Security Protocol

Try it Yourself

Experiment with the code from this lesson in our interactive playground.

Open Playground
MySQL Topic Hub

Stuck on this lesson?

Join our community of senior developers.

Ask in Forum