February 2018
Intermediate to advanced
510 pages
16h 10m
English
The CURRENT_TIME() function can be used to find the current time on the server. It is also possible to add or subtract time values using the ADDTIME and SUBTIME functions. For example, the following example adds two hours to the server's current time:
mysql> SELECT CURRENT_TIME() AS 'CUR_TIME', ADDTIME(CURRENT_TIME(), 020000) AS 'ADDTIME', SUBTIME(CURRENT_TIME(), 020000) AS 'SUBTIME';+----------+-----------+-----------+| CUR_TIME | ADDTIME | SUBTIME |+----------+-----------+-----------+| 10:12:34 | 12:12:34 | 08:12:34 |+----------+-----------+-----------+
The UTC_TIME() function can be used to fetch the UTC time.
Read now
Unlock full access