MySQL CURRENT_TIME() Function

The CURRENT_TIME() function in MySQL retrieves the current time from the database server. It's very useful for adding timestamps to your data, creating time-based reports, or performing time-related calculations.



CURRENT_TIME(): Definition and Usage

CURRENT_TIME() is frequently used to record when events occur or data is modified within a MySQL database. The function returns the current time, either as a string (in 'HH:MM:SS' format) or a numeric value (HHMMSS.uuuuuu), depending on how it's used in your query. The time shown reflects the server's system clock.

Equivalent Function: CURTIME()

The CURTIME() function is identical to CURRENT_TIME(); both return the current time.

Syntax

Syntax

CURRENT_TIME()
      

Examples

Getting the Current Time

This query retrieves the current time.

Syntax

SELECT CURRENT_TIME();
      
Output

15:22:34 (Example output; the time will vary based on your server's clock)
      

Adding to the Current Time

Adding 1 to the time adds one second. Note that how MySQL handles this might depend on your server's settings.

Syntax

SELECT CURRENT_TIME() + 1;
      
Output

15:22:35 (Example output; one second added to the current time)
      

**Note:** The time shown in the examples is a sample. The actual output will reflect the current time on your MySQL server when you run the query. The format might vary slightly depending on your MySQL server's settings.