ans
time_to_sec(timediff(endTime, startTime))
timestampdiff(second, startTime, endTime)
unix_timestamp(endTime) -unix_timestamp(startTime)
tips
mysql的時間相減是做了一個隱式轉換操作,直接把年月日時分秒拼起來:
2022年3月27日 19:15:56
轉換為 20220327191556
所以必須使用上述函數進行相減