Name

CURRENT_TIME( )

Synopsis

CURRENT_TIME( )

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

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.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.