CURRENT_TIME( )

This MySQL function returns the current time in hh:mm:ss format. This is synonymous with CURTIME( ).

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

CURRENT_TIME()

Explanation

This function returns the current time in hh:mm:ss format. It will return the time in the hhmmss format, in numeric format if it's used as part of a numeric calculation. The parentheses are not required. It's synonymous with CURTIME().

Examples

INSERT INTO appointments
(client_id, appt_date, start_time)
VALUES('1403', CURRENT_DATE( ), CURRENT_TIME);

In this example, we're logging an unscheduled appointment that has just begun so that we can bill the client later. Of course, it's easy enough to use one datetime column with the NOW( ) function for inserting data, and other functions for extracting separate components later.