Mysql ADDTIME
From w3cyberlearnings
Contents |
MySQL ADDTIME Function
This function uses to add time.
Syntax ADDTIME
- expr1: date or time string expression.
- expr2: time string expression.
ADDTIME(expr1, expr2);
Example 1
mysql> SELECT ADDTIME('2012-04-21 10:40:11', '1:04:40'); +-------------------------------------------+ | ADDTIME('2012-04-21 10:40:11', '1:04:40') | +-------------------------------------------+ | 2012-04-21 11:44:51 | +-------------------------------------------+ 1 row in set (0.00 sec)
Example 2
mysql> SELECT ADDTIME('2012-04-21 10:40:11', '31:04:40'); +--------------------------------------------+ | ADDTIME('2012-04-21 10:40:11', '31:04:40') | +--------------------------------------------+ | 2012-04-22 17:44:51 | +--------------------------------------------+ 1 row in set (0.00 sec)
Example 3: add time only
mysql> SELECT ADDTIME('10:40:11', '31:04:40'); +---------------------------------+ | ADDTIME('10:40:11', '31:04:40') | +---------------------------------+ | 41:44:51 | +---------------------------------+ 1 row in set (0.00 sec)