Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Reference » SQL Functions » Alphabetical list of functions

SECOND function [Date and time] Next Page

SECONDS function [Date and time]

The behavior of this function can vary depending on what you supply:

Syntax 1: integer

SECONDS( [ datetime-expression, ] datetime-expression )

Syntax 2: timestamp

SECONDS( datetime-expression, integer-expression )


datetime-expression    A date and time.

integer-expression    The number of seconds to be added to the datetime-expression. If integer-expression is negative, the appropriate number of minutes is subtracted from the datetime value. If you supply an integer expression, the datetime-expression must be explicitly cast as a datetime data type.

See also
Standards and compatibility

The following statements return the value 14400, signifying that the second timestamp is 14400 seconds after the first.

SELECT SECONDS( '1999-07-13 06:07:12',
   '1999-07-13 10:07:12' );

   '1999-07-13 06:07:12',
   '1999-07-13 10:07:12' );

The following statement returns the value 63062431632.

SELECT SECONDS( '1998-07-13 06:07:12' );

The following statements return the datetime 1999-05-12 21:05:12.0.

SELECT SECONDS( CAST( '1999-05-12 21:05:07'
SELECT DATEADD( second, 5, '1999-05-12 21:05:07' );