CacheSQL datediff format hhmm
-
29-06-2021 - |
Question
I need to calculate the variance in minutes or hours from two columns. Using datediff(hh,start,stop) is sometimes to big and datediff(mi,start,stop) is sometimes to little. How can I get it show up as hh:mm? Thanks!
Solution
SELECT {fn TRUNCATE(DATEDIFF('mi',start,stop)/60,0)}
|| ':'
||{fn MOD (DATEDIFF('mi',start,start) ,60)}
From MySchema.MyTable
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow