SUBTIME()

Overview

Subtracts a TIME from a TIME or DATETIME and returns the result.

USAGE

SUBTIME(starting_time, subtracting_time)

Argument Name

Description

starting_time

The starting TIME or DATETIME value

subtracting_time

The TIME value to subtract

DETAILS

SUBTIME() is a date-time function that subtracts one time expression from another.

The return value matches the type of the starting_time argument, which can be either a TIME or DATETIME field or string value.

A time value can also contain a count of days in front of the normal hours/minutes/seconds in order to subtract time values greater than a single day. The hours number can also be larger than 24 as a way to express more than one day's worth of time.

The maximum returned time value is 813:59:59.999999.

A NULL is returned if any argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT SUBTIME('23:59:59.99', '01:01:01.01') AS result;
+-----------------+
| result          |
+-----------------+
| 22:58:58.980000 |
+-----------------+
SELECT SUBTIME('2019-12-30 23:59:59.99', '2 2:2:2') AS result;
+----------------------------+
| result                     |
+----------------------------+
| 2019-12-28 21:57:57.990000 |
+----------------------------+
SELECT SUBTIME('2 00:00:00', '48:00:00') AS result;
+-----------------+
| result          |
+-----------------+
| 00:00:00.000000 |
+-----------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES