MySQL CURTIME() Function

The CURTIME() function in MySQL provides a simple way to retrieve the current time from the database server.



CURTIME(): Definition and Usage

This function is extremely useful for tasks that require timestamps, such as logging events, tracking actions, or performing time-based calculations within your MySQL applications. The time is returned as a string (HH:MM:SS) or a number (HHMMSS), depending on the context.

Equivalent Function

The CURRENT_TIME() function is functionally identical to CURTIME().

Syntax

Syntax

CURTIME()
      

Examples

Getting the Current Time

This query returns the current time as a string.

Syntax

SELECT CURTIME();
      
Output

14:37:22 (Example output; the time will vary depending on when you run it)
      

Adding to the Current Time

Adding 1 to the time adds one second. How MySQL handles this will depend on your server configuration.

Syntax

SELECT CURTIME() + 1;
      
Output

14:37:23 (Example output; one second added to the current time)