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

SQL Anywhere 11.0.0 » UltraLite - Database Management and Reference » UltraLite SQL Reference » UltraLite SQL function reference » Alphabetical list of functions

 

MINUTES function [Date and time]

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

  • If you give a single date, this function returns the number of minutes since 0000-02-29.
    Note

    0000-02-29 is not meant to imply an actual date; it is the date used by the date algorithm.

  • If you give two time stamps, this function returns the integer number of minutes between them. Instead, use the DATEDIFF function.
  • If you give a date and an integer, this function adds the integer number of minutes to the specified timestamp. Instead, use the DATEADD function.
Syntax 1: integer
MINUTES( [ datetime-expression, ] datetime-expression )
Syntax 2: timestamp
MINUTES( datetime-expression, integer-expression )
Parameters
  • datetime-expression   A date and time.

  • integer-expression   The number of minutes 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.

Remarks

Since this function returns an integer, overflow can occur when syntax 1 is used with time stamps greater than or equal to 4083-03-23 02:08:00.

See also
Standards and compatibility
  • SQL/2003   Vendor extension.

Example

The following statements return the value 240, signifying that the second timestamp is 240 seconds after the first. It is recommended that you use the second example (DATEDIFF).

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

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

The following statement returns the value 1051040527.

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

The following statements return the timestamp 1999-05-12 21:10:07.000. It is recommended that you use the second example (DATEADD).

SELECT MINUTES( CAST( '1999-05-12 21:05:07'
AS DATETIME ), 5); 

SELECT DATEADD( minute, 5, '1999-05-12 21:05:07' );