sql server 計算兩個時間 相差的 幾天幾時幾分幾秒

蘭博丶專屬發表於2018-10-22
	CAST ( CAST ( DATEDIFF ( ss, StartTime, ConcludeTime ) / ( 60 * 60 * 24 ) AS INT ) AS VARCHAR ) + `天` + CAST ( CAST ( DATEDIFF ( ss, StartTime, ConcludeTime ) % 86400 / 3600 AS INT ) AS VARCHAR ) + `小時` + CAST ( CAST ( DATEDIFF ( ss, StartTime, ConcludeTime ) % 3600 / 60 AS INT ) AS VARCHAR ) + `分` + CAST ( CAST ( DATEDIFF ( ss, StartTime, ConcludeTime ) % 60 AS INT ) AS VARCHAR ) + `秒` LengthOfTime 

  

相關文章