MySQL CURRENT_TIME() Function
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 from0to6specifying fractional seconds precision (microseconds). Omittingfspdefaults to0.
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
NULLcolumn inputs: BecauseCURRENT_TIME()takes no required data input,NULLfields indemo_employeeswill not causeCURRENT_TIME()to fail or returnNULL. fspmust be a literal0through6: PassingCURRENT_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 toDATETIMEcolumns; compare againstTIMEvalues instead. - Bad numeric math: Adding
CURRENT_TIME + 100uses base-10 integer arithmetic and can produce invalid clock values like145965. UseADDTIME(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).
Unlock Your
Full Potential.
Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.
Quick Access With
Try it Yourself
Experiment with the code from this lesson in our interactive playground.