Function Reference

SECOND

PostgreSQL equivalent:

Returns the seconds of a time.

MySQL 8.1
SECOND(time)

Parameters

timeTIME
Time or datetime

Return value

An integer from 0 to 59; fractional seconds are dropped; NULL if the value is not recognized

Examples

Seconds from a date and time

MySQL 8.1
SELECT SECOND('2022-06-16 16:37:03');
SECOND('2022-06-16 16:37:03')
3

Fractions of a second dropped

MySQL 8.1
SELECT SECOND('16:37:03.75');
SECOND('16:37:03.75')
3

See also