SECOND Function

Description

The SECOND function returns the seconds in the range of 0 to 59 from specified argument. You can specify the TIME, TIMESTAMP, or DATETIME; the value is returned in INTEGER type.

If the function fails, NULL is returned when the database server configuration parameter return_null_on_function_errors is set to yes. When the parameter is set to no, the function outputs error message. The default value of return_null_on_function_errors is no.

Syntax

SECOND(time)

Example

SELECT SECOND('12:34:56');

   second('12:34:56')

=====================

                   56

 

SELECT SECOND('2010-01-01 12:34:56');

   second('2010-01-01 12:34:56')

================================

                              56

 

SELECT SECOND('2010-01-01 12:34:56.7890');

   second('2010-01-01 12:34:56.7890')

=====================================

                                   56

 

SELECT SECOND ('2010-01-01');

 

ERROR: Conversion error in time format.