我們如何將時間間隔新增到儲存在 MySQL 表格列中的日期?
MySQL ADDTIME() 函式可用於將時間間隔新增到儲存在表列中的資料。此函式的語法為 ADDTIME(date, ‘expression unit’)。可以透過使用“collegedetail”表中的資料遵循以下示例進行演示。
mysql> Select estb, ADDTIME(estb, '05:04:25')AS 'Date with time' From collegedetail WHERE ID = 111; +------------+---------------------+ | estb | Date with time | +------------+---------------------+ | 2010-05-01 | 2010-05-01 05:04:25 | +------------+---------------------+ 1 row in set (0.02 sec)
此處,“estb”為 “collegedetail”表的列,其日期為值。
廣告