MariaDB SECOND() Function
In MariaDB, SECOND()
is a built-in function that returns the seconds portion of a given time expression.
MariaDB SECOND()
Syntax
This is the syntax of the MariaDB SECOND()
function:
SECOND(time)
Parameters
time
-
Required. A time or datetime expression.
If you supply the wrong number of arguments, MariaDB will report an error: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' '06:30:45')'
.
Return value
The MariaDB SECOND()
function returns the second part of the given time expression, and the return value of the SECOND()
function is between 0
to 59
.
If the argument is NULL
, the SECOND()
function will return NULL
.
MariaDB SECOND()
Examples
The following statement shows the basic usage of the MariaDB SECOND()
function:
SELECT
SECOND('10:11:12'),
SECOND('2022-02-28 10:11:12');
Output:
+--------------------+-------------------------------+
| SECOND('10:11:12') | SECOND('2022-02-28 10:11:12') |
+--------------------+-------------------------------+
| 12 | 12 |
+--------------------+-------------------------------+
Conclusion
In MariaDB, SECOND()
is a built-in function that returns the seconds portion of a given time expression.