MySQL SUBTIME() Function

MySQL | SUBTIME() Function: Learn about the SUBTIME() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on October 13, 2022

SUBTIME() Function

The SUBTIME() function subtracts the time from the given interval and as a result, it returns the time after the subtraction of the time interval.

SUBTIME() Syntax

SELECT SUBTIME(datetime value, time interval);

SUBTIME() Parameter(s)

This function takes two parameters-

  • datetime value: You have to provide a particular datetime value.
  • time interval: You also have to provide a time interval from which you want to be subtracted.

SUBTIME() Return Value

As a result, it will return you the time after the subtraction of the interval.

MySQL SUBTIME() Function Example 1

SELECT SUBTIME("2011-06-11 12:14:33.000012", "12.000001");
Example 1: MySQL SUBTIME() Function

MySQL SUBTIME() Function Example 2

SELECT SUBTIME("2011-06-11 12:14:33.000012", "11:10:01:001220");
Example 2: MySQL SUBTIME() Function

MySQL SUBTIME() Function Example 3

SELECT SUBTIME("09:14:33.000012", "11:10:01:001220");
Example 3: MySQL SUBTIME() Function


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.