SECOND()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the seconds from a given time.
USAGE
SECOND(time)
Argument Name | Description |
---|---|
| The time string or number to evaluate |
DETAILS
SECOND()
is a date-time function that returns the seconds from a given time argument.
The time
argument can be in string (hh:mm:ss
or hh:mm
) or numeric (hhmmss
) format. Both style of input can also specify fractional seconds after a decimal point.
The returned value of a valid time is in the range of 0
to 59
. Any fractional seconds are discarded.
A NULL
is returned if the argument is NULL
or otherwise invalid.
EXAMPLES
SELECT SECOND('12:01:30');
+--------------------+
| SECOND('12:01:30') |
+--------------------+
| 30 |
+--------------------+
SELECT SECOND('12:01');
+-----------------+
| SECOND('12:01') |
+-----------------+
| 0 |
+-----------------+
SELECT SECOND('12:34:56.7890');
+-------------------------+
| SECOND('12:34:56.7890') |
+-------------------------+
| 56 |
+-------------------------+