Subtract 5.000001 seconds and return the resulting datetime.
SELECT SUBTIME(“2017-06-15 10:24:21.000004”, “5.000001”); |
The SUBTIME() function subtracts a specified time interval from a time or datetime expression and returns the resulting time or datetime.
SUBTIME(datetime, time_interval) |
Parameter |
Description |
datetime |
Required: The time or datetime to be adjusted |
Time_interval |
Required: The time interval to subtract from the datetime. Both positive and negative values are permitted. |
Works in: |
From MySQL version 4.0 |
Subtract 3 hours, 2 minutes, and 5.000001 seconds and return the resulting datetime.
SELECT SUBTIME(“2017-06-15 10:24:21.000004”, “3:2:5.000001”); |
Subtract 5 seconds and return the resulting time.
SELECT SUBTIME(“10:24:21”, “5”); |
Subtract 3 minutes from a time and return the resulting time.
SELECT SUBTIME(“10:24:21”, “300”); |
Add 3 hours, 2 minutes, and 5 seconds to a time and return the resulting time.
SELECT SUBTIME(“10:24:21”, “-3:2:5”); |