Forum Discussion
Anonymous
7 years agoNot applicable
datetime difference as decimal number
HI all, I need a column to calculate datetime difference between two datetime columns, enddate - startdate. Both columns are in this format 7/19/2018 8:31:00 AM I will add conditional colu...
- Anonymous7 years ago
Hi there,
I think DATEDIFF can handle negative numbers now, DATEDIFF(startdate, enddata, HOUR) should work.
The other way of doing this would be to calculate:
(enddate - startdate) * 24 for hour,
(enddate - startdate) * (24 * 60) for minutes,
(enddate - startdate) * (24 * 60 * 60) for seconds.Best regards,
Kristjan
Anonymous
7 years agoNot applicable
Hi there,
I think DATEDIFF can handle negative numbers now, DATEDIFF(startdate, enddata, HOUR) should work.
The other way of doing this would be to calculate:
(enddate - startdate) * 24 for hour,
(enddate - startdate) * (24 * 60) for minutes,
(enddate - startdate) * (24 * 60 * 60) for seconds.
Best regards,
Kristjan