本文介紹了如何獲得 T SQL 中 2 次之間的微小差異?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
如何在 T SQL 中獲得兩次之間的分鐘"差異?我試過 DATEDIFF,但它顯然想要日期.這將是一天中兩次之間的分鐘差異.有什么建議嗎?
How do I get the "minutes" difference between 2 times in T SQL? I tried DATEDIFF, but it obviously wants dates. This would be the difference in minutes between 2 times in a day. Any suggestions?
推薦答案
我認為 DATEDIFF 是您的最佳選擇.我知道您正在尋找同一天的時間差異,但是您不能只傳遞 DATEDIFF 兩個日期時間相同但時間不同的 DateTime 類型嗎?
I think DATEDIFF would be your best option. I know you are looking for the difference in time within the same day, but couldn't you just pass DATEDIFF two DateTime types with the same date, but different times?
// Should return 300
DATEDIFF(mi, '2015-02-19 08:00:00', '2015-02-19 13:00:00')
這篇關于如何獲得 T SQL 中 2 次之間的微小差異?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!