timediff() 是 MySQL 日期/時間函數。它用於獲取與給定兩個時間/日期時間的差異。
用法
select timediff(time1, time2)
參數:
time1, time2: 獲取差異的時間值
返回值:
此函數返回兩個時間/日期時間值之間的差異。
例子1
select timediff('01:25:23','12:56:12');
輸出:

例子2
select timediff('2018-02-03 12:56:12','2018-10-03 01:25:23');
輸出:

相關用法
- MySQL timestamp()用法及代碼示例
- MySQL time_to_sec()用法及代碼示例
- MySQL time_format()用法及代碼示例
- MySQL time()用法及代碼示例
- MySQL to_day()用法及代碼示例
- MySQL ROUND()用法及代碼示例
- MySQL REPEAT()用法及代碼示例
- MySQL POWER()用法及代碼示例
- MySQL LEAD() and LAG()用法及代碼示例
- MySQL IS_IPV4()用法及代碼示例
- MySQL WEEK()用法及代碼示例
- MySQL CHARACTER_LENGTH()用法及代碼示例
- MySQL CURTIME()用法及代碼示例
- MySQL weekofyear()用法及代碼示例
- MySQL CURRENT_TIME()用法及代碼示例
- MySQL Convert()用法及代碼示例
- MySQL FROM_BASE64()用法及代碼示例
- MySQL OCT()用法及代碼示例
- MySQL PI()用法及代碼示例
- MySQL CONCAT()用法及代碼示例
注:本文由純淨天空篩選整理自 MySQL Date/Time timediff() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。