欢迎各位兄弟 发布技术文章
这里的技术是共享的
这里 '1 1:1:1.000002' 表示加一天再带1小时1分1.000002秒 如果没有空格 即 11:1:1.000002 表示加11小时1分1.000002秒 mysql> SELECT ADDTIME('1997-12-31 23:59:59.999999','1 1:1:1.000002'); +---------------------------------------------------------+ | DATE_ADD('1997-12-31 23:59:59.999999','1 1:1:1.000002') | +---------------------------------------------------------+ | 1998-01-02 01:01:01.000001 | +---------------------------------------------------------+ 1 row in set (0.00 sec)
The following statement will return a time after adding 2 days 1 hr. 39 min. and 27.50 sec. with the datetime 2008-05-15 13:20:32.50.
Output
mysql> SELECT ADDTIME('2008-05-15 13:20:32.50','2 1:39:27.50') as required_datetime; +----------------------------+ | required_datetime | +----------------------------+ | 2008-05-17 15:00:00.000000 | +----------------------------+ 1 row in set (0.00 sec)